Paulinho’s late strike denied England a famous victory in the Maracana as Roy Hodgson’s men regained some pride following a difficult week for the national side.
Joe Hart performed brilliantly to keep the game goalless at half-time – the match coming alive after the break.
In the first game at the world-famous Maracana since its £300m redevelopment England started comfortably but Brazil did have an early chance through Neymar, whose shot was blocked by Baines.
The home side bossed the first half but couldn’t take advantage. But they did grab the lead after the break.
Hernanes curled a wonderful shot that beat Hart but bounced out to Fred and he did not miss from 10 yards.
Hodgson made an attacking substitution, with Alex Oxlade-Chamberlain coming on for Johnson. And he pulled England level, drilling a low shot beyond Julio Cesar.
It was England who were now on the front foot and amazingly they took the lead, Wayne Rooney curling a shot up and over Cesar via a big deflection off Fernando
But the visitors couldn’t hang on. Eight minutes from time Lucas Moura put in a good cross for Paulinho and he fired past Hart from 15 yards.
Three minutes of added time came and went before the referee called time on what was ultimately an encouraging result.