The 21-year-old Spaniard put in a sizzling lap of one minute 54.507 seconds as the chequered flag fell under the Losail circuit floodlights to knock compatriot Alvaro Bautista off the top slot.
Bautista, on a non-factory Honda, was second fastest behind the works bike in 1:54.564 with Britain's Bradley Smith securing the first front row position of his MotoGP career on a Tech3 Yamaha.
Early Spanish favourite Aleix Espargaro, who had dominated free practice, crashed twice in the session - returning to the pits for a spare bike after the first fall - and ended up in ninth position.
Twice world champion Jorge Lorenzo will be fifth on the grid for the factory Yamaha team with Italian colleague Valentino Rossi lining up in 10th.
Marquez, who fractured the fibula in his right leg while dirt-bike riding six weeks ago, looked comfortable enough on his Honda and was all smiles although he said the race would be a different story.
"Tomorrow is the most important," he said. "The leg will be difficult at the end of the race because I'm getting tired, I do a lot of power with that.
"Anyway, I will try. Tomorrow I think we can do a good race."
Until this week's practice, the youngest-ever MotoGP champion had not ridden the Honda since his Feb. 6 accident.
When he arrived in Qatar he told reporters he was not able to walk five days earlier: "Step by step it's becoming better," he had said. "So if I can walk I think on the bike it'll be OK."
Results from the Motorcycling Grand Prix Qatar MotoGP Qualification
1. Marc Marquez (Spain) Honda 1:54.507
2. Alvaro Bautista (Spain) Honda 1:54.564
3. Bradley Smith (Britain) Yamaha 1:54.601
4. Andrea Dovizioso (Italy) Ducati 1:54.644
5. Jorge Lorenzo (Spain) Yamaha 1:54.661
6. Dani Pedrosa (Spain) Honda 1:54.703
7. Stefan Bradl (Germany) Honda 1:54.871
8. Cal Crutchlow (Britain) Ducati 1:54.888
9. Aleix Espargaro (Spain) Yamaha 1:54.986
10. Valentino Rossi (Italy) Yamaha 1:55.096
- Sports & Recreation
- Alvaro Bautista
- Aleix Espargaro
- Bradley Smith