The pair were on top throughout, with Marquez setting the early pace before Espargaro lowered the benchmark to a 1m51.130s with 13 minutes to run.
Marquez's threat tailed off in the immediate aftermath of that lap, and in his stead it was Espargaro's Pons Kalex stablemate Esteve Rabat who looked most likely to challenge for pole.
With two minutes remaining, and while on his fastest lap, Rabat overcooked it however, running through the gravel and curtailing his bid.
Espargaro then shaved a quarter of a second off his own benchmark, which ultimately proved decisive as Marquez improved late on.
The Monlau Suter rider's time was enough to move into second, but still more than one tenth down on Espargaro's 1m50.886s.
Scott Redding sealed fourth on his Marc VDS Kalex, with Thomas Luthi (Paddock Suter) and Johann Zarco (JIR Motobi) taking a share of the second row.
Bradley Smith, Julian Simon and Nico Terol will start from seventh to ninth respectively.
As Marquez and Espargaro took up their typical positions at the front, the championship's third-place rider Andrea Iannone endured a torrid session.
Having struggled throughout practice, the Italian was running just 17th when he fell at Turn 9. He was able to resume but could not improve and was demoted to 18th at the flag.
He will therefore start directly behind Mika Kallio, who had a controversial clash with Marquez in third practice - the Spaniard hitting Kallio's bike and leaving the Finn in the gravel after a failed attempt overtaking bid.