ALCANIZ, Spain — Marc Marquez won the Aragon MotoGP on Sunday for his second straight victory, taking the outright championship lead with four races to go.

Marquez rode his Honda to victory after starting fifth on the grid, finishing comfortably ahead of fellow Spaniards Dani Pedrosa of Honda and Jorge Lorenzo of Ducati.

Pole-sitter Maverick Vinales ended fourth, just ahead of Yamaha teammate Valentino Rossi, who was racing for the first time since undergoing surgery for breaking two bones in his right leg while training with an off-road motorcycle three weeks ago. The nine-time world champion missed the San Marino GP because of the injury.

Marquez, who crashed in qualifying on Saturday, nearly lost control while trying to get past Rossi and Lorenzo early in the race, missing the braking point and going slightly off the track before being able to pick up the pace again.

Marquez took the lead with seven laps to go and held on to finish nearly one second ahead of Pedrosa.

“It was really tough,” Marquez said. “If it wasn’t at this track, in front of these fans, maybe I would have thrown in the towel. I wasn’t comfortable out there. I was fighting against the bike and nearly crashed many times. I had to take some risks and I went for it. This victory means a lot.”

It was the fifth win of the year for Marquez, who is 16 points in front of Andrea Dovizioso. The Italian could not manage more than a seventh-place finish at the MotorLand track in northeastern Spain. Marquez and Dovizioso were tied for the lead entering the weekend.

Vinales is third in the standings, 28 points behind Marquez and 26 points in front of fourth-place Pedrosa. Fifth-place Rossi is 56 points from the lead.

“The main opponents for the championship lost some points, so we opened a small advantage and it’s very important to arrive in Japan with that very small advantage,” Marquez said.

The Japanese GP is on Oct. 15.

Marquez reached his 60th career win, with 34 coming in the main MotoGP series.

The defending MotoGP champion hadn’t won after starting outside of the first row since 2014.

It was the second podium of the season for Lorenzo with Ducati.

“We are progressing very quickly,” Lorenzo said. “Especially my side, knowing more the bike, knowing the way to get the maximum, especially on the race.”

It was the second time that the top 4 riders in a MotoGP race were Spaniards. It hadn’t happened since the Japanese GP in 2013.

Seven of the top 10 finishers on Sunday were from Spain.

Italian Franco Morbidelli won the Moto2 race and Spaniard Joan Mir was first in Moto3.

Mir has won eight of the 14 races this season, a record for the series. He later was handed a six-place grid penalty for the next race for “irresponsible riding” after appearing to veer from side to side on the final lap.