MADRID — Barcelona and Real Madrid won their matches Sunday with the Spanish league title race now guaranteed to go to the final round.

Neymar scored a hat trick for Barcelona in a comfortable 4-1 win at Las Palmas, while Cristiano Ronaldo scored a pair of goals for Madrid in a 4-1 home victory over Sevilla.

Madrid scored with an unusual goal by Nacho Fernandez, who sent a quickly taken free kick into the net while the Sevilla defence and goalkeeper were preparing to set up a wall.

The results left the rivals even on points, with Barcelona ahead on the head-to-head tiebreaker. But Madrid can retake sole possession of the lead on Wednesday when it plays at Celta Vigo in a game postponed from February.

Madrid needs four points from its last two games to secure the title regardless of Barcelona's result against Eibar at home next weekend. Madrid's final game is at Malaga.

"In these next two games we need to keep doing the same thing that we have been doing so far," Madrid coach Zinedine Zidane said. "It's what has taken us this far."

Madrid is trying to win its first league title since 2012, while Barcelona is seeking its third straight La Liga trophy.

Atletico Madrid secured third place and an automatic spot in next season's Champions League with a 1-1 draw at Real Betis, while Sevilla guaranteed fourth place and a chance to reach the European competition through the playoffs.

Sporting Gijon became the third and final team to be relegated despite a 1-0 win at Eibar. It needed Leganes to lose at Athletic Bilbao, but the recently promoted club drew 1-1 to remain in the top division for a second straight season. Deportivo La Coruna also guaranteed a place in the top flight after a 0-0 draw at Villarreal. Granada and Osasuna had already been demoted.

Villarreal, Athletic and Real Sociedad are the teams still fighting for the two Europa League spots.

___

REAL MADRID 4, SEVILLA 1

Madrid kept its title chances in its own hands thanks to the win over Sevilla at the Santiago Bernabeu.

Nacho opened the scoring 10 minutes into the match by catching the Sevilla defence by surprise with his free-kick shot. Nacho sent it into the back of the net as goalkeeper Sergio Rico only watched.

"It was a matter of quick thinking," Nacho said. "I saw that the players were out of position and I decided to take the shot."

Ronaldo added to the lead in the 23rd and scored again in the 78th after Stevan Jovetic had pulled Sevilla closer with a goal early in the second half. Toni Kroos closed the scoring in the final minutes.

Madrid, playing without many regular starters, reached 62 straight games scoring at least one goal, surpassing the mark set by Bayern Munich from 2013-14.

Zidane's team was coming off an intense midweek match against Atletico Madrid in the semifinals of the Champions League, when it advanced to set up a final against Juventus.

It was the third straight game without a win for Jorge Sampaoli's Sevilla, which contended for the title for most of the league.

___

LAS PALMAS 1, BARCELONA 4

Barcelona cruised to victory over Las Palmas to stay in front, and now it starts hoping for a Madrid setback.

Neymar and Luis Suarez scored a goal each in the first half, and the Brazilian striker added two more in the second.

Las Palmas scored its lone goal with Pedro Bigas when the score was 2-0 to Barcelona.

"We played a smart game," said Barcelona coach Luis Enrique, who couldn't count on defenders Gerard Pique and Javier Mascherano because of injuries. "It wasn't an easy match."

___

Tales Azzoni on Twitter: http://twitter.com/tazzoni