Honda's Marquez takes pole position for Portugal MotoGP
The six-time MotoGP champion Marquez, who also starts from pole for the sprint later on Saturday, said he was stunned to have qualified first.
The Spaniard said he had managed to sneak onto pole by following other riders after three seasons ruined by injury and surgery.
"To be honest it wasn't the most polite way to do a lap time because I followed other riders," Marquez told Canal+.
"We know it's not our real position and really I still don't understand what I'm doing here in pole position.
"Let's enjoy it and it will be a big advantage for this afternoon and tomorrow."
As well as qualifying for pole, Marquez is first in the new sprint race introduced for the first time in MotoGP after the format was a success in Formula 1 last season.
Unlike F1 the MotoGP half-length, half points, sprint race will be contested every Saturday.
Ducati man Bagnaia said it had been a highly competitive final session.
"I'm satisfied with that. In the first session we had the possibility to do a lot. But in the second one there were four riders in it. So I think we can do something good from here," he said.
Pre-season testing suggested Bagnaia is again the fastest rider on the fastest bike and is poised to continue the domination he established late last season