Petronas Yamaha's Franco Morbidelli produced a masterclass to keep the Suzuki duo of Alex Rins and Joan Mir at bay.
Rins finished second behind the Italian, while championship leader Mir, who has yet to win a race this season, started 12th on the grid and finished third, extending his lead to 14 points over Morbidelli's team mate Fabio Quartararo who finished eighth.
Polesitter Takaaki Nakagami, who became the first Japanese rider in 16 years to clinch a premier-class pole, endured heartbreak when he crashed on the opening lap while the LCR Honda rider was in the lead.
Grand Prix Valencia
'An inspiration for me' - Federer leads Rossi tributes after final race
"When I had clean air in front of me, I decided to give everything I had in every single lap," Morbidelli, who started second on the grid, said in the post-race interview.
We adjusted the bike very well to be fast throughout the race so I could ride with precision and aggression the whole time.
Morbidelli's victory moved him up to fourth in the championship standings behind Yamaha's Maverick Vinales, who finished seventh.
Rins said the wear on his soft front tyre prevented him from challenging Morbidelli towards the end of the race and decided to play it safe to secure Suzuki's double podium while Mir said a podium was "like a victory" after starting 12th on the grid.
"Today, to give a bit more was a bit too much," Mir said after his sixth podium in eight races.
"The guys in front of me were a bit far at the beginning and I couldn't recover the distance. I couldn't be faster today (but) another podium is an amazing result from 12th on the grid."
Pol Espargaro and Miguel Oliveira finished fourth and sixth for their respective KTM teams, with Johann Zarco the lone Ducati in the top five sandwiched between the two.
Andrea Dovizioso's title challenge also began to fade as the Italian Ducati rider slipped to fifth in the championship standings - 28 points behind Mir - after a 13th-placed finish.
Rossi announces decision to retire at end of season
MotoGP star Jason Dupasquier dies after crash