MADRID (AP) -- The Copa del Rey trophy could have been coach Jose Mourinho's parting gift for Real Madrid, or at least a consolation prize after a disappointing season filled with locker-room turmoil and failure in La Liga and the Champions League.
Instead, Atletico Madrid ended a 25-game, 14-year winless streak against its rival, getting a 98th-minute goal from Miranda for a 2-1 victory in the Copa del Rey final on Friday night following the ejections of Mourinho and Real star Cristiano Ronaldo.
Ronaldo put Madrid ahead in the 14th minute with a header, his 55th goal of the season, but Atletico tied the score in the 35th minute when Radamel Falcao set up Diego Costa.
Atletico, which had 19 losses and six draws against Real since its previous victory, won its 10th Copa del Rey title and first since 1996.
"This is for our fans that have suffered for 14 years," Atletico captain Gabi Fernandez said before receiving the trophy from Spain's King Juan Carlos. "I think this team worked hard for this and deserved it."
Mourinho was sent off for protesting a foul in the 76th minute. Likely heading back to Chelsea this summer, he is set to finish without a title in what appears to be the last of his three seasons in Madrid.
Before that, Mourinho had spent most of the match in the dugout. He was jeered by both sets of fans before kickoff at Real's Santiago Bernabeu stadium, with the home supporters upset at his treatment of goalkeeper Iker Casillas and supposed desire to leave.
"This is my worst season. I have never not won an important title. You can say I failed this season," Mourinho said. "With one final, a semifinal, a second-place finish, and a Spanish Supercup, for many other coaches it would have been a good season. For me it's the worst."
Mourinho repeated he will decide his future with club president Florentino Perez after the season ends in early June.
Ronaldo received a straight red card in the 114th for kicking Fernandez in the face, setting off a sideline scuffle. Gabi was ejected seconds before the final whistle for a second yellow card.
Ronaldo and teammates Mesut Ozil and Karim Benzema all hit posts with shots before Atletico went ahead when Miranda, a Brazilian defender, headed in a cross from Jorge "Koke" Resurrecion.
"We had the good fortune that a champion needs," said Atletico coach Diego Simeone, who added the cup to the Europa League title won last year. "What these players have done for the past year and a half is amazing. I don't have words for it."
Atletico goalkeeper Thibaut Courtois made one-on-one stops to deny Gonzalo Higuain in the 104th and Ozil in the 109th. He also was struck on the head by an object thrown from the stands shortly after.
"It isn't normal to hit the post three times," Mourinho said. "You don't have to be an expert to think that the result wasn't fair, that Atletico isn't the just winner. But in football all that is forgotten, the posts, the referee, and Atletico goes down the winner."