Briton Cal Crutchlow had threatened a top-three finish but a crash with 10 laps to go meant that he ended eighth.
Lorenzo told BBC Sport: "When it rains, you need to keep concentration. I knew Casey Stoner was close behind but I kept calm and didn't force things."
Stoner had been second for most of the race, but was edged out by previously out-of-form Rossi in an engrossing contest between the pair - a reminder of times gone by - in the closing stages.
The Italian took advantage of his bike's aptitude in these conditions in front of more than 80,000 spectators.
Lorenzo savours 'sweet' victory
On Thursday afternoon, Stoner had
made his shock announcement
about finishing his career in MotoGP at the end of this season, stating that he was "not enjoying" the sport.
The race itself began with Randy de Puniet - in his home Grand Prix - spinning out at the start line, showing the potential difficulties ahead for riders in the slippery conditions.
Despite the testing surface, Yamaha rider Lorenzo surged into an early advantage, building a lead of almost five seconds after five laps over second-placed Stoner. Rossi made a promising start too.
Crutchlow edged into the top three with 16 laps to go and an intriguing battle for a place on the podium began to develop midway through the race, with Italians Rossi and Andrea Dovizioso involved.
When the Englishman started pushing hard, he suffered a nightmare scenario as he slid out, causing him to drop back to eighth. There has not been a Brit on the podium since 2000 and the wait has been prolonged because of his first crash this year.
Crutchlow told BBC Sport: "It was my own fault. I'm not blaming anything apart from myself but I was pleased to get up and finish. Hopefully it'll be dry in Barcelona."
Dovizioso went down in the final four laps, paving the way for Rossi to finish on the podium and he began pushing Stoner hard before eventually moving ahead.
Rossi admitted: "I am so happy. It was a great battle with Casey at the end and great fun."
Meanwhile, Briton Scott Redding finished third in the Moto2 GP, which contained a series of crashes in the poor conditions. Swiss Thomas Luthi was the victor with Italian Claudio Corti in second.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.