Martin, who was second in Argentina last weekend, put in a memorable performance after only sneaking into the final qualifying round.
He edged out Jack Miller by just 0.003sec with fellow Ducati riders Francesco Bagnaia, Johann Zarco and Enea Bastianini making up the top five.
Martin has now qualified on the front row for all four races this season.
Six-time MotoGP world champion Marc Marquez will start in ninth place on his Honda as the 29-year-old returns after missing the Argentina race.
He suffered double vision after a violent high-side crash in Indonesia last month.
Marquez has won seven of the eight races contested at the Texas track.
World champion Fabio Quartararo, fastest in practice, will start Sunday's race in sixth place after falling off his Yamaha.
Current world championship leader Aleix Espargaro of Aprilia, who won his maiden MotoGP race at the 200th time of asking last weekend in Argentina, missed out on the qualifying shootout after a crash.
The 32-year-old Spaniard will start Sunday's race 13th on the grid.
In Moto2 qualifying, American rider Cameron Beaubier claimed his maiden pole position by 0.3sec over world championship leader Celestino Vietti who rides for Valentino Rossi's academy team.
Aron Canet, who overcame a late crash, makes up the front row.