MADRID, Spain -- Atletico Madrid and Barcelona will play a winner-takes-all decider for the Spanish league title after both teams drew on Sunday, while Real Madrid lost to see its slim title hopes end.

Little-used defender Tobias Alderweireld headed home a corner kick for Atletico in the 74th minute to cancel out Samuel Garcia's opener.

Though Malaga finished with 10 men, Atletico failed to score a winner that would have secured a first league title in 18 years after Elche held Barcelona 0-0.

Instead, Atletico travels to the Camp Nou next weekend for a dramatic finale to decide the champion.

Atletico leads with 89 points, three better than Barcelona, which means a draw will be enough to pry the championship away from the defending champion, which must win to retain its title.

"We still believe in this team. We're Atletico and we're going to go there to win," Atletico captain Gabi Fernandez said. "We're used to playing in finals."

Madrid, which has 84 points, limped out of the league race with a poor showing in Vigo, where a pair of turnovers allowed Charles to score both goals in a 2-0 win.

Madrid faces Atletico in the Champions League final and played as if it was already looking ahead to Lisbon as defensive mistakes by Sergio Ramos and Xabi Alonso allowed Charles to net easily. Cristiano Ronaldo was sidelined with an injury and Gareth Bale was on the bench.

Atletico was also without leading scorer Diego Costa and looked disjointed early on, with replacement David Villa unable to finish three good scoring opportunities -- including early on when the Spain striker found the crossbar.

Atletico midfielder Raul Garcia headed well wide just before the break with only Willy Caballero to beat, and the Malaga 'keeper made key stops from Villa and substitute Diego Ribas in the second half.

Thibaut Courtois rushed out to cut off Roque Santa Cruz's solo effort on the hour mark, but the Atletico goalkeeper's mix-up with defender Miranda allowed Samuel Garcia head home the opener.

With nerves rising, Alderweireld -- filling in for the suspended Diego Godin -- leapt high to head home a corner that allowed home fans to exhale.

Marcos Angeleri's second yellow card left Malaga with 10 men from the 88th, and Atletico pushed forward as Jose Sousa's free kick narrowly missed the target before Caballero made a leaping finger-tip stop to Adrian Lopez's curling shot in the injury time.

Barcelona, which counted itself out of the title race only eight days ago, came out at Elche with intention but eventually seemed to settle for its result when word of Malaga's first goal arrived.

Andres Iniesta volleyed a shot off the crossbar early on before goalkeeper Manu Herrera got a touch to Lionel Messi's effort in the 38th to tip it around the far post. Herrera denied Messi again after the restart, but the defending champions barely threatened again.

"We can look ourselves in the mirror and be happy," Barcelona defender Javier Mascherano said. "It's going to be a great week ahead and for some of us it could be our last game with Barca so it would be a nice way to go out."

Atletico hasn't lost to Barcelona this season, drawing in four matches before finally beating the Catalans in the second leg of the Champions League quarterfinals.

Sami Khedira and Alvaro Arbeloa returned from long injuries to play for Madrid.