MADRID — Valencia needed to win no matter what to try and change its fortune after one of its worst starts ever in the Spanish league, and it did it with the help of an own goal and a late penalty kick against Alaves on Thursday.

Fans breathed a huge sigh of relief at the final whistle as Valencia salvaged the 2-1 victory that halted a four-game losing streak and left the team without a coach and in crisis.

Daniel Parejo scored the winner by converting an 88th-minute penalty kick at Mestalla Stadium, moving Valencia out of last place in its first game following the firing of coach Pako Ayestaran.

"We needed this win, especially at home," Parejo said. "We didn't play great football, but we did what we had to do."

Valencia opened the scoring with an own goal by Víctor Laguardia, who headed the ball into the top corner while trying to clear it from the area. Striker Gaizka Toquero equalized off a corner just before halftime to again dim the hopes of the more than 30,000 Valencia fans at Mestalla.

Many were already jeering the team when Belgian midfielder Zakaria Bakkali was brought down just inside the area to prompt the penalty that was calmly converted by Parejo, sending Alaves goalkeeper Fernando Pacheco the wrong way.

Valencia moved above Granada and Osasuna, which lost at Espanyol 2-1 earlier. In the other match of the day, promoted Leganes came from behind to defeat Deportivo 2-1 in La Coruna and jump to 10th place.

Real Madrid, which was held by Villarreal to 1-1 at home on Wednesday, led the league by two points from Sevilla. Barcelona was third.

It was the first loss for promoted Alaves, which dropped to 12th in the standings. The team's only victory so far came at Barcelona at the Camp Nou two weeks ago.

Valencia is looking for its third coach since Nuno Espirito Santo left the team in November 2015. Gary Neville arrived but stayed in charge less than five months before being replaced by Ayestaran. The team is being led by interim coach Salvador Gonzalez "Voro."

No coach has stayed more than two years at the club since Unai Emery was in charge from 2008-12.

Valencia, owned by Singapore investor Peter Lim since 2014, is the last team other than Real Madrid, Barcelona, and Atletico to win the league title, in 2004.

___

Tales Azzoni on Twitter: http://twitter.com/tazzoni. His work can be found at http://bigstory.ap.org/content/tales-azzoni