Valentino Rossi has claimed his first victory for the Yamaha team in 2014 at the San Marino GP.
Marc Marquez was in close pursuit of the Italian rider for large spells, but the championship leader fell off his bike in turn nine to allow the 35-year-old claim another victory.
Jorge Lorenzo, who started on pole position, came home in second place to make it a Yamaha one-two. This was the team's first one-two in four years.
Dani Pedrosa finished in third place for the Honda team after fighting off the very impressive Andrea Dovizioso in the Ducati.
Lorenzo started the race well as he maintained the lead in the opening laps. However, the Spanish rider was unable to break away from Rossi and Marquez and it was not long until both riders made their passing moves.
This would create a ding-dong battle between the leading duo, as both riders exchanged the lead of the race on a number of occasions throughout the race.
Marquez was trying to find his way around the nine-time World Champion again, but in turn nine he lost the front end into the heavy-breaking corner. This was Marquez's first crash in a race this season, and his last one was back in 2013 in Mugello.
Elsewhere on the track, Andrea Iannone equaled his best finishing position of fifth place and Aleix Espargaro fell on the final lap, which allowed Marc Marquez to come home with one point for finishing in 15th place.