British rider Danny Kent won his second Moto3 race of the year in Valencia as the season came to an end.
Kent, 18, passed his world champion team-mate Sandro Cortese at the final corner to take the victory on his final appearance in the class.
The rider from Chippenham will move up to the Moto2 class next season.
He told BBC Sport: "I was worried because we had struggled in the rain all weekend but I felt good from the start in the race."
Kent's win, coming after he also won in Japan last month, means he finishes the season fourth in the championship.
In a crash-strewn race on a damp track, Kent slowly moved up the field after starting from seventh on the grid and denied Cortese his sixth win of the season with a bold move into the final turn of the last lap.
German rider Cortese said: "To be honest I didn't know what happened. I had a one second gap going into the last lap so I don't know where he came from!
"But it has been a perfect season and congratulations to Danny, he did a great job."