Real Madrid struggled to an unconvincing 4-2 win over Osasuna on Saturday as the Jose Mourinho era came to an end in an atmosphere of division at the Bernabeu.
Madrid squandered a 2-0 lead provided by Gonzalo Higuain and Michael Essien as Osasuna rallied with second-half goals from Roberto Torres and Alvaro Cejudo, but Karim Benzema and Jose Callejon scored late on to end the season with a victory.
Before the match, the Portuguese coach gave a short goodbye in a statement on Madrid's website after a three-year stint in the Spanish capital.
"I wish all of Real Madrid's supporters much happiness in the future," Mourinho said. "I want to thank many fans for their support, and I respect the criticism of others. I repeat, happiness to all, and above all, good health. Hala Madrid!"
Opinion on Mourinho's legacy at the club would appear to be split among the Madrid faithful, with one section of the stadium singing the coach's name throughout the match, while other sections of the ground did their best to drown them out with boos and whistles.
Real Madrid defender Alvaro Arbeloa launched a defiant defense of Mourinho.
"Yes, it's a shame that Mourinho is leaving because he has given his life for the club. He has sacrificed a lot for this club, and he has suffered," Arbeloa told Gol TV. "He's always put Madrid first, ahead of himself and at the cost of his own image. I don't think that anyone at this club, including the players, could say the same.
"It's a shame that he hasn't been able to take more advantage of these three years by winning more titles."
The Portuguese coach named an eye-catching starting 11, giving goalkeeper Jesus Fernandez his first appearance of the season, as first-choice Diego Lopez was missing after undergoing an ear operation.
Club captain Iker Casillas was again left out of the squad entirely despite being fit, while Cristiano Ronaldo, Xabi Alonso and Sergio Ramos were all missing through injury, leaving room for Omar Mascarell and Diego Llorente to make their debuts off the bench.
Osasuna was also fielding an under-strength side, and also had little to play for, having secured survival last weekend.
The Navarrans began the game well and had the first proper attempt on goal, withn Joseba Llorente heading a cross toward the bottom corner and forcing a good save from Jesus.
Cejudo then beat the offside trap and was one-on-one with Jesus but shot over, and a few moments later David Timor shot straight at the Madrid goalkeeper, who caught the ball easily.
Higuain gave Madrid the lead after 34 minutes, beating the offside trap to get onto a through ball from Essien, and then planting a shot in the bottom corner, scoring his 122nd and last goal for the club after a six-year stint.
Higuain confirmed after the game that he will leave Real Madrid.
"It's not easy, but I want to go to another club, new challenges," said Higuain, who has been linked to Juventus.
The second arrived just a few minutes later. Essien header a corner from Mesut Ozil down into the bottom corner at the near post, and then ran to embrace Mourinho, who previously managed him at Chelsea.
Roberto Torres pulled one back for Osasuna seven minutes into the second half, cutting inside from the left-hand side of the area and hitting a powerful shot into the bottom corner.
Callejon should have restored Madrid's advantage just moments later, but his shot did not have enough power on it and Osasuna goalkeeper Asier Riesgo pushed it away.
Osasuna then completed its comeback, with Cejudo arriving at the far post ahead of Nacho to head past Jesus.
Benzema restored Madrid's lead after 69 minutes, controlling a pass from Ozil and then smashing his shot into the far corner.
The Frenchman soon had the ball in the net again, but his effort was ruled offside, before Callejon secured the points, finishing off a classic Madrid counter-attack created by Higuain and Benzema.
At the final whistle, there would be no lap of honor from the Madrid players or the departing coach, who waved toward the loyal Ultras Sur in the South stand before taking his leave.
Arbeloa said Mourinho had not won as much as he would have hoped since joining Madrid from Inter Milan in 2010, and feels everyone, both players and the coaches, were to blame.
"I feel that we could have achieved a lot more because of the potential of the squad and the coaching staff," he said. "We are all responsible. Mourinho has won trophies everywhere he has been and it seems strange to me that this squad, which is the best, is the place where he's won the least."
Information from Press Association was used in this report.