Real six clear after Barce beaten by Getafe
European and Spanish champions Barca dominated the match at the Coliseum but could not beat keeper Miguel Angel Moya and Juan Valera stunned the visitors with a goal in the 67th minute.
The defender headed in from a corner and then the rest of his team manned the barricades for a desperate siege in the closing minutes.
Earlier, Cristiano Ronaldo scored two penalties as Jose Mourinho's Real Madrid side came back from a goal down at the Bernabeu to beat their long-suffering neighbours who had goalkeeper Thibaut Courtois sent off in the 22nd minute.
Angel di Maria and Gonzalo Higuain also scored as Atletico, who had taken the lead through Adrian Lopez, finished with nine men after defender Diego Godin also saw red near the end.
Real's 13th consecutive win in all competitions put them on 34 points from 13 games and moved them six ahead of Barca, who have to visit the Bernabeu in two weeks' time.
"It's a shame because we are further behind, but we gave our all today," Spain and Barca striker David Villa told reporters.
"Getafe kept it very tight and their keeper was very good."
Valencia kept pace with the top two, on 27 points in third, with a 2-1 win at promoted Rayo Vallecano.
Brazilian striker Jonas fired them in front from distance in the 21st minute and, after keeper Diego Alves had kept them in the match with a couple of fine saves, Argentine Tino Costa doubled the lead with a rasping drive in the 56th.
Rayo substitute Raul Tamudo pulled a goal back for the hosts, stabbing the ball in from close range after appearing to control it with his arm six minutes from time.
Barcelona became bogged down at Getafe and they were hit with a sucker-punch when Valera headed in at a corner.
Lionel Messi led Barca's charge at the other end and was unlucky to have a goal ruled out for offside in the 90th minute.
The World Player of the Year then hit the post in time added on, and, just before the final whistle, Moya somehow denied Pedro on the line.
Up the road at the Bernabeu, Adrian had lifted Atletico hopes that they might end a 12-year wait for a win over their neighbours with a well-worked goal after only 15 minutes, but their joy was short lived.
Belgian Courtois, on loan from Chelsea, brought down Karim Benzema in a one-on-one the area and was sent off in the 22nd minute. Ronaldo netted from the spot and Atletico's chances of an upset slowly evaporated.
"It's clear we have had similar situations in the area as those today which didn't up with the same result," Atletico coach Gregorio Manzano said of the Courtois red card.
"It may have been a penalty but it wasn't a sending off. In an important game like this it can be decisive."
Di Maria put the hosts in front soon after the re-start and Higuain profited from a mix-up between Godin and his keeper to roll a third int