Barcelona maintained their slight La Liga title hopes as they came from 2-0 down to beat Villarreal 3-2 on an emotionally-charged night at El Madrigal when players and fans remembered Tito Vilanova.
However, Atletico Madrid remain in the driving seat for their first title in 18 years as they ground out a 1-0 win away to Valencia.
The Catalans paid their respects to former coach Vilanova with a minute's silence before the game, but a miserable week looked set to end with a sixth league defeat of the season as Cani and Manu Trigueros gave Villarreal a commanding lead.
However, own goals from Gabriel and Mateo Musacchio brought Barca level before Lionel Messi grabbed the winner eight minutes from time.
Atletico continue to lead Barca by four points with just three games remaining, whilst Real Madrid fall to third, a further two points back, but with a game in hand.
"We played with fire," Barca midfielder Andres Iniesta admitted. "We weren't playing badly but the goal just before half-time affected us. Then it went 2-0, but we fought until the end because that is all we can do until the end of the season."
And the Spanish international added that Vilanova's example in his fight with cancer for over two years will remain with them.
"Something like that always affects you a lot. We lived through a lot together and I am left with the example he has been to us until the end."
Despite another difficult week off the field, Barca had started positively as Sergio Asenjo made a low save from Messi before Gabriel blocked Xavi's goalbound effort.
However, Villarreal were always dangerous on the counter-attack and after Marc Bartra had cleared Javier Aquino's effort off the line, Barca were caught out again moments later when Jonathan Pereira crossed for Cani to slot home.
Trigueros doubled Villarreal's advantage 10 minutes into the second-half when he was well-picked out by Aquino and cushioned a header low past Jose Manuel Pinto from the edge of the area.
Barca got back into the game with a fortunate break 25 minutes from time when Dani Alves' cross was deflected into his own net by Gabriel.
Alves was then the subject of a shocking incident as a banana was thrown at the Brazilian as he prepared to take a corner, provoking the full-back to take a bite of the banana before continuing on with the game.
And Alves was the source of Barca's equaliser when Musacchio this time misjudged a header from his cross to send the ball past the helpless Asenjo.
Messi then sealed the comeback as a fine move involving Sergio Busquets and Cesc Fabregas ended with the Argentine drilling home his 40th goal of the season.
Earlier, Raul Garcia starred for Atletico as he got the only goal of the game just before half-time to secure a ninth straight league win and move his team within two more victories of sealing the championship.
"We have two incredibly powerful teams behind us that will give everything and won't allow us to relax," insisted Atletico boss Diego Simeone.
"We have to continue being calm and take every game as it comes." Despite the second leg of his side's Champions League semi-final against Chelsea being just three days away, Simeone named a strong side with David Villa and Tiago coming into the side that started the first leg against the English club in midweek.
However, Simeone claimed important victories for both Atletico, and Chelsea over Liverpool on Sunday, won't make any difference at Stamford Bridge come Wednesday.
"The league doesn't have anything to do with the Champions League. Chelsea have a great team as they have shown by rotating players and still winning 2-0 today. They are a very strong team that will cause us a lot of problems."
Atletico made the vital breakthrough two minutes before half-time when Gabi's lofted ball into the area picked out the run of Garcia and he cushioned a header in off the inside of the post to register his 17th goal of the season.
Diego Costa should have put the game to bed six minutes into the second half when he was played clean through on goal, but he delayed his shot and allowed Vicente Guaita to save with an outstretched leg.
However, despite having Juanfran sent-off deep into stoppage time, the league leaders held on for a sixth consecutive clean sheet to move ever closer to the title.
Elsewhere, Athletic Bilbao strengthened their grip on Spain's fourth Champions League place for next season with a 3-1 win over Sevilla at San Mames.
The Basques now lead Sevilla by six points with just three games remaining.