BARCELONA, Spain — A year ago, Sandro Ramirez wasn't good enough for Barcelona.

Now, the Catalan club is hoping the cast-off forward can upend Real Madrid's march to the Spanish league title.

For Barcelona to win a third consecutive league title it needs to beat Eibar at home on Sunday and have Malaga defeat Madrid, which enters the final round needing only one point to claim its first title since 2012. And the in-form Ramirez is Malaga's biggest threat.

Told last May there was no room for him alongside Lionel Messi, Neymar and Luis Suarez, Ramirez could understandably savour Barcelona's struggles this season. But the 21-year-old Spaniard said he would love nothing more than to give back something to the club that made him into a professional at its "La Masia" academy.

"I really hope I can score a goal and give Barca the league," Ramirez told BEIN television. "I really hope that this dream comes true. I owe them everything."

Ramirez left his home in the Canary Islands to join Barcelona's academy when he was 14. His road wasn't easy, however. He had to recover from injuries to both knees before he earned his debut with the first team under Barcelona coach Luis Enrique in 2014.

But not even Pedro Rodriguez's departure for Chelsea opened up consistent playing time. With six goals in two seasons playing limited minutes, Barcelona sporting director Robert Fernandez decided not to renew Ramirez's contract last May.

So, for nothing in return, Barcelona let Ramirez walk away while it paid Valencia 30 million euros (then $33.5 million) for striker Paco Alcacer.

"Last season was the most difficult one for me," Ramirez said. "But you know that the guys in front of you are the best, so I don't regret anything."

Ramirez found a spot on Malaga, signing for three seasons. After a slow start, he is finishing the season in spectacular form. Malaga has won six of its last eight matches, with Ramirez scoring seven of his 14 goals this season in those recent victories.

None was bigger than his opening goal in a 2-0 win over Barcelona on April 8 that robbed it of the chance of capitalizing on Madrid's 1-1 draw with Atletico Madrid just hours before.

Ramirez said the goal against his former team "helped vindicate me."

"I didn't celebrate it like a goal scored against the best team in the world, but I must give it my all for Malaga," he said.

Malaga's surge has come under coach Michel Gonzalez, a former Madrid player who took over in March with the team in danger of being dragged into a relegation fight.

The players responded and reeled off wins over Sevilla, Valencia and Celta Vigo, in addition to the upset of Barcelona, to settle into 11th place.

"From the very first day (Michel) said that I was fundamental for him and that is what a football player needs to hear," Ramirez said. "Confidence is critical in football. I am ambitious and I know I can give a lot more. We are playing well. It's my desire to finish this in the best way possible."

No doubt Barcelona shares that wish as well.