Dani Pedrosa completed the podium, while Stefan Bradl, Andrea Iannone, Bradley Smith and Alvaro Bautista all crashed out while running inside the top four.
The drama started on the first lap, as Lorenzo leapt from fifth to the lead before Turn 1, and then set a blistering early pace as he attempted to establish an early gap.
Before one lap had been completed however his race was wrecked, as he lost the front at Turn 15 and crashed heavily into the gravel.
Bradley Smith inherited the lead, only to suffer his own wobble which allowed Stefan Bradl and polesitter Marc Marquez to slip by.
The order swung once more when Iannone fell from fourth and then Bradl dropped his LCR Honda at Turn 6, allowing Marquez to hit the front.
Rossi, though, picked off the Spaniard at Turn 15, in what was just the first of a sequence of attacks and counters that lasted all the way until the flag.
After several aborted attempts, Marquez eventually reclaimed the lead at three-quarter distance, but he was unable to break Rossi and came under increasing pressure from the Italian.
With two laps to go that climaxed as Rossi hit the front once more at Turn 4.
Marquez responded in typically aggressive fashion, but was repassed - and then fought back once more - over the final turns.
Rossi remained locked onto Marquez's wheel throughout the final lap, but was unable to mount a serious attack and came home second, just 0.259s splitting the pair at the flag.
Marquez's victory, which comes just six weeks after he broke his leg, gives him an early lead points lead in his 2014 title defence.
Pedrosa secured third, but only after another dramatic fall when Bautista - who made a poor start but was otherwise a permanent fixture at the front - fell at Turn 2 two laps from the finish.
Smith, running a secure fifth, had slipped up at the same turn just three laps previously.
The attrition meant Aleix Espargaro was able to come through to finish fourth ahead of Andrea Dovizioso and Cal Crutchlow.
2013 Moto2 runner-up Scott Redding meanwhile just beat 2006 world champion Nicky Hayden to seventh.
The duo, both riding Honda's Open machine, were separated by just 0.035s at the finish.
Results from the Motorcycling Grand Prix Qatar MotoGP on Sunday
1. Marc Marquez (Spain) Honda 42:40.561
2. Valentino Rossi (Italy) Yamaha 42:40.820
3. Dani Pedrosa (Spain) Honda 42:43.931
4. Aleix Espargaro (Spain) Yamaha 42:52.184
5. Andrea Dovizioso (Italy) Ducati 42:52.720
6. Cal Crutchlow (Britain) Ducati 43:09.087
7. Scott Redding (Britain) Honda 43:13.154
8. Nicky Hayden (U.S.) Honda 43:13.189
9. Colin Edwards (U.S.) Yamaha 43:20.108
10. Andrea Iannone (Italy) Ducati 43:23.921
11. Hiroshi Aoyama (Japan) Honda 43:27.156
12. Yonny Hernandez (Colombia) Ducati 43:27.249
13. Karel Abraham (Czech Republic) Honda 43:31.142
14. Danilo Petrucci (Italy) ART 43:43.688
15. Broc Parkes (Australia) PBM 43:54.947
- Sports & Recreation
- Marc Marquez
- Stefan Bradl
- Andrea Iannone
- Dani Pedrosa
- Bradley Smith
- Alvaro Bautista
- Valentino Rossi