The 41-year-old was last on the podium at the Americas GP in April last year.
Rossi started the race from second row on the grid and launched well to secure third place out of the first corner.
However, with the reigning champion Marc Marquez out with a broken humerus, the race went to Frenchman Fabio Quartararo who led from start to finish.
The youngster quickly pulled away from the pack with a three-second gap from second position by just Lap 6.
It soon became a fight for second, while riders also battled extreme track conditions with some parts of the Spanish circuit over 63°C.
Only 13 out of 21 riders completed the race.
Italian Pecco Bagnaia was in second position with only six laps to go when he was forced to retire after smoke began to steam from his engine.
This saw Rossi gain second position, closely hunted by his Yamaha teammate Maverick Vinales.
A great defence game by Rossi held off Vinales for several laps.
But the Italian veteran went slightly wide at Turn 9 with just one lap to go, allowing Vinales to skim through and secure second place.
Quartararo finished almost nine seconds ahead of Vinales, making it back-to-back victories for the 21-year-old Frenchman.
This marked Rossi’s 199th MotoGP podium.
Catch the third round of the MotoGP on August 9, 10:00 pm AEST, at the Czech Republic GP.
Andalucia GP Results
- Quartararo (FRA) - Petronas Yamaha
- Vinales (SPA) - Monster Yamaha
- Rossi (ITA) - Monster Yamaha
- Nakagami (JPN) - LCR Honda
- Mir (SPA) – Suzuki Ecstar
- Dovizioso (ITA) - Ducati
- Pol Espargaro (SPA) – Red Bull KTM Factory
- Alex Marquez (SPA) – Repsol Honda
- Zarco (FRA) – Real Avintia
- Rins (SPA) - Suzuki Ecstar
- Rabat (SPA) - Reale Avintia Ducati
- Smith (GBR) Aprilia (test rider)
- Crutchlow (GBR) - LCR Honda
DID NOT FINISH
Bagnaia (ITA) - Pramac Ducati
Morbidelli (ITA) - Petronas Yamaha
Petrucci (ITA) – Ducati
Miller (AUS) - Pramac Ducati
Espargaro (SPA) - Aprilia Gresini
Oliveira (POR) - Red Bull KTM Tech3
Binder (RSA) - Red Bull KTM
Lecuona (SPA) - Red Bull KTM Tech3