On a memorable night, which saw Ashley Cole claim his 100th cap for his country, England went ahead on 27 minutes through Wayne Rooney.
His goal came just moments after Joe Hart had brilliantly kept out Ronaldinho's penalty but, just after the break, Brazil substitute Fred flashed home an excellent equaliser and not long after he struck the woodwork.
But it was another replacement - Frank Lampard - who ensured England beat Brazil for the first time in 23 years as the midfielder side-footed home clinically from the edge of the box to give Roy Hodgson's side victory.
England looked dangerous early on with Jack Wilshere impressing on his return to the international stage, but he was adjudged to have handled a Ronaldinho cross, which gave the Atletico Mineiro man a chance to open the scoring.
However, on his 100th appearance for his country, Ronaldinho saw his shot parried by Hart and the Manchester City keeper beat him to the rebound before Neymar was unable to convert from close range.
It was no surprise, though, that Arsenal midfielder Wilshere played a major part in the build-up to England's opening goal after 26 minutes from Rooney.
His pass picked out the surge forward of Gunners team-mate Theo Walcott, whose low drive was blocked by QPR keeper Julio Cesar. However, Rooney seized on the rebound and coolly tucked away his 33rd goal for his country with a low drive straight down the middle of the goal.
England attacked with plenty of pace and Walcott fired over the bar but they had a let-off after 37 minutes when the highly-rated Neymar slid in at the far post and shot over from close range after Oscar had outpaced Chelsea team-mate Cole before crossing.
Leighton Baines and Lampard replaced Cole and Tom Cleverley respectively at the start of the second period, whilst Brazil made a hat-trick of substitutions with Fred, Arouca and Lucas replacing Fabiano, Ramires and Ronaldinho.
Steven Gerrard forced Cesar to parry his dipping drive two minutes into the second half but a mistake by Gary Cahill saw Fred equalise 60 seconds later.
The Chelsea defender was caught in possession bringing the ball out from defence and in an instant Fred drilled a fierce shot past Hart from the edge of the box. The goalscorer almost struck again when his shot rattled the bar after Hart's clearance had bounced off Cahill.
But Cahill almost made amends for his error when he got on the end of a Gerrard corner and saw his header tipped over the bar by Cesar. The keeper then fingertipped away Walcott's ball into the danger area but Gerrard could not keep his follow-up shot down.
England were not to be denied the win over Brazil as Lampard restored their lead on the hour. Walcott's centre was only partially cleared and Wilshere turned the ball back to Lampard, whose curling shot hit the inside of a post and crossed the line for his 27th England goal.