(CNN) -- Argentine Gonzalo Higuain scored a penalty six minutes into stoppage time as Real Madrid beat neighbors Atletico Madrid 2-1 in a dramatic derby clash at the Vicente Calderon stadium.
Riuud van Nistelrooy celebrates his opening goal, but he was later sent off in Real Madrid's dramatic 2-1 win.
The win moves the Spanish champions up to second in the table behind Villarreal, who are top of the Primera Liga table after a 0-0 draw at Espanyol in Saturday's late match.
Portuguese winger Simao thought he had salvaged a point for Atletico after curling home a 90th-minute free-kick to cancel out Ruud van Nistelrooy's opener after just 32 seconds -- but there was a twist to come.
Higuain converted a penalty in the 96th minute to crush Atletico's spirits ahead of Wednesday's Champions League duel against Liverpool.
It also continued Atletico's jinx against their city rivals -- who they have not beaten since 1999.
Dutchman van Nistelrooy caught Atletico napping with a drilled shot to put Real ahead but the Dutchman's day went sour on 38 minutes when he was sent off for the second time this season for a late tackle on Maniche.
Eight minutes earlier, Atletico had been reduced to 10-men when referee Clos Gomez claimed Colombian defender Luis Perea caught Wesley Sneijder with a stray arm.
Atletico were desperate not to concede an ealy goal after their recent 6-1 rout by Barcelona -- but that plan went out the window with van Nistelrooy caught goalkeeper Leo Franco off guard with a fierce snapshot. Then, on three minutes, Sneijder fizzed in a shot that Franco tipped on to the crossbar.
It was a frantic opening and van Nistelrooy thought he had made it 2-0 after 20 minutes but the effort was controversially ruled out for offside. Minutes later, Raul had the ball in the net only to be flagged offside in another tight call.
Already against it, Atletico gave themselves a mountain to climb when Perea was red-carded for catching Sneijder with a stray arm in the face.
It was hard to tell whether it was intentional but the referee had no doubt and brandished a straight red. Eight minutes later the numbers were evened up when van Nistelrooy was issued his marching orders although a yellow card seemed more appropriate.
Simao thought he had saved Atletico from the jaws of defeat with his free-kick but Atletico conceded a late spot-kick when Real substitute Royston Drenthe was tripped by defender John Heitinga and Higuain's penalty crept past the unlucky Franco.
"It is devastating to concede a goal in the first minute and another one in the 95th," admitted Atletico coach Javier Aguirre.
"I don't think there is a mental problem but now we have to pick the players up for the Liverpool game on Wednesday. We are doing well in the Champions League and this game deserves our full attention."
Meanwhile, Villarreal goalkeeper Diego Lopez brilliantly saved a 70th minute penalty from Raul Tamudo to maintain his team's unbeaten start to the season.