Martin, meanwhile, can claim the title on Saturday if he brings his Ducati through to take the sprint.
"This afternoon will not be easy," said Bagnaia. "But we have to try to win and take it into tomorrow."
"(It is) super important to start well and lead from the start, maybe open a bit of a gap. I will try everything," he added.
Bagnaia clocked one minute and 38.641 seconds, just 0.055sec ahead of Aprilia's Aleix Espargaro, taking part in his 255th and final race before retiring.
Marc Marquez, of the Ducati satellite team Gresini, was third quickest, nudging Martin off the front row.
The race was due to take place in Valencia but had to be moved after the region suffered its worst floods in a generation which have killed more than 220 people.
The race was switched to the Circuit de Barcelona-Catalunya and has been dubbed the Solidarity GP to show support for the people of Valencia.
The sprint takes place at 14:00 GMT - 10 PM on Saturday in the Philippines.