Sporting a special helmet fearing a cartoon image of Rossi as a bruised boxer on the ropes, Rossi used his new chassis and swingarm to keep a slight buffer over Bautista.
Rossi finished 4.3s from Lorenzo and 1.6s ahead of Bautista, then headed straight to the fans to celebrate.
Bautista had been overtaken by Andrea Dovizioso
into the final turn, but got a better exit and claimed his first MotoGP rostrum by just 0.003s.
Dovizioso's Tech 3 Yamaha team-mate Cal Crutchlow, who began the race from the front row, was third into the first chicane - then passed by Bradl and later Dovizioso before crashing out on lap 5 of 27.
Having held third for much of the race, Bradl dropped down the order to sixth, Lorenzo's team-mate Ben Spies also overtaking the Honda LCR rider.
Rossi's team-mate Nicky Hayden
finished seventh on his return from injury, with Jonathan Rea two-seconds behind the American on his MotoGP debut.
World Superbike star Rea, replacing the injured Casey Stoner
at Repsol Honda, began the race in ninth place - and had lost out more than most due to the damp free practice sessions.
Rea is all but certain to get another race outing at Aragon.
Aspar Aprilia's Randy de Puniet
was forced to take avoiding action in the Barbera/Pedrosa clash, but reached ninth and top CRT rider by the finish.
Gresini CRT rider Michele Pirro took tenth in his home race, followed by Colin Edwards
Yonny Hernandez (Avintia), James Ellison
(PBM), Danilo Petrucci - making his Suter-BMW debut for Ioda - and David Salom (Avintia) were the final riders to reach the flag. It was Salom's first race as a replacement for Ivan Silva.
Abraham's bike suffered another problem on the restart.
All 21 riders began the race with the harder Bridgestone front tyre and softer rear.
Round 14 of 18 will be held at Aragon, Spain on September 28-30.
San Marino Grand Prix:
1. Jorge Lorenzo
2. Valentino Rossi
3. Alvaro Bautista
4. Andrea Dovizioso
5. Ben Spies
6. Stefan Bradl
7. Nicky Hayden
8. Jonathan Rea
9. Randy De Puniet
10. Michele Pirro
11. Colin Edwards
12. Yonny Hernandez
13. James Ellison
14. Danilo Petrucci
15. David Salom