Andretti Autosport's Herta made his final pitstop a lap sooner than Palou and paid the penalty in the closing stages, as he was forced to lower his pace and tumbled back to finish fifth.
Josef Newgarden (Team Penske) finished second, ahead of a closely matched Pato O'Ward (Arrow McLaren) and Scott Dixon (Ganassi).
Poleman Herta had earlier led the field slowly to green and he held his lead at Turn 1, with Palou moving to O'Ward's inside to grab second. O'Ward was forced to back off and Kyle Kirkwood (Andretti Autosport) got into the back of him, spinning himself at Turn 1. Moments later there was more drama as Santino Ferrucci (AJ Foyt Racing) was edged onto the grass on back stretch by O'Ward.
With Kirkwood stalled in the run-off, the race went full-course yellow. It restarted on lap four, with Herta leading Palou, Marcus Armstrong (Ganassi), Newgarden, Alexander Rossi (McLaren), Christian Lundgaard (Rahal Letterman Lanigan Racing), O'Ward, Devlin DeFrancesco (Andretti), Marcus Ericsson (CGR) and Ferrucci (the only driver in the top 10 who started on the Firestone alternate red tires).
Lundgaard passed Rossi for fifth on lap five, while O'Ward was penalized two spots for his conduct on the opening lap, dropping him back to ninth. Lundgaard then attacked Newgarden for fourth at Turn 5, but was mercilessly shoved wide onto the grassy runoff, causing him to lose the spot he'd gained from Rossi. No action was taken by race stewards.
A few laps later, Felix Rosenqvist – who'd pitted his McLaren under yellow for fresh primary tires and was leading those that were off strategy – was punted off by Rinus VeeKay (Ed Carpenter Racing) at Turn 3, dropping him from 14th to last. Surprisingly, VeeKay wasn't judged to be at fault for avoidable contact.
Grosjean spun out of 17th position at Turn 3 on lap 12 and got stranded in the gravel, sending the field to the pits ahead of the inevitable caution. Herta rejoined ahead of Palou, but Newgarden passed Armstrong in the pits for third – the latter being released into the path of Simon Pagenaud's Meyer Shank Racing car, for which he received a one-position penalty to promote Rossi to fourth.
The race was due to go green on lap 16 but Jack Harvey ploughed his RLL car into the gravel at the final corner. It went green again on lap 20, and Armstrong retook fourth from Rossi at Turn 5, while O'Ward passed Lundgaard for sixth.
At the back end of the top 10, Ericsson and Ferrucci banged wheels at Turn 5, and then Ericsson clipped Pagenaud at Turn 6.
Rossi passed Armstrong for fourth at Turn 1 on lap 23, just before Palou ran wide at Turn 5 and Newgarden elbowed his way into second on the run to Turn 6. A lap later, O'Ward passed Armstrong at Turn 6 when the Kiwi had lost momentum after failing to pass Rossi a corner earlier.
Just before half distance, the fourth caution was required when David Malukas's Dale Coyne Racing car became stranded at Turn 8. Herta's lead over 1.5s over Newgarden was thus voided.
Under yellow, Palou just won the race off pitlane, ahead of Newgarden and Herta (who chugged away from his pitbox), O'Ward and Rossi.
Armstrong stayed out, so he led the restart from an off-sequence Will Power (Penske), with Palou heading the stoppers who opted for reds, comprising Newgarden, Herta, O'Ward, Rossi and Scott McLaughlin (Penske). Dixon was ninth, having got rid of his reds early on.
Newgarden suffered a disastrous restart when he got tangled up with backmarkers, dropping back to sixth and having to get his elbows out against team-mate McLaughlin, losing him a spot to his fellow Kiwi Dixon. Newgarden and Dixon would later switch the position.
Herta passed Palou at Turn 6 on lap 30, Colton having replied "oh ****" when told how many laps he had to complete on the reds. Armstrong pitted from the lead on lap 32, promoting Power to P1, who was pulling clear of his pursuers on the alternates until he pitted on lap 34.
Herta led fellow red-runners Palou, O'Ward and Newgarden, with Dixon sitting pretty in fifth on blacks should those ahead dropped off a cliff of grip. A charging Ericsson passed fellow black-running Rosenqvist, who'd toiled to get past his team-mate Rossi, and then made short work of Rossi himself to run sixth.
But the track had rubbered-in so much that the reds clung on in terms of pace compared to earlier stints, so Herta was still in a handy lead when pitted for fresh blacks with 15 laps remaining.
Palou ran a lap longer, pitting ahead of O'Ward, Newgarden, Dixon and Ericsson. Herta retook the lead, having used the majority of his push-to-pass on the in- and out-laps, and pulled clear to the tune of 1.2s, as Newgarden got ahead of O'Ward for third.
A wild moment then occurred as Lundgaard just missed Rossi, who was exiting the pits, to grab sixth. Ericsson, who lost spots in the final round of stops, had to battle past Rosenqvist – who lost ground at this point – while McLaughlin stayed ahead and was now up to eighth.
Power was running out front again, but had to make another pitstop, so all eyes were on the gap between Herta and Palou, which plummeted to 0.3s with nine laps remaining as Herta drove to his bigger fuel number due to stopping earlier.
Palou made his move at Turn 1 with seven laps to go, whistling around the outside of Herta. Newgarden, O'Ward and Dixon did likewise on the laps that followed, making it a painful end to a race for Herta that he'd earlier dominated.
Palou cruised to the finish to win by 4.5s, despite a sketchy moment when he had to pass Armstrong on the outside of The Kink on the final lap.
Lundgaard suffered an off inside the final five laps, allowing Ericsson up to sixth. McLaughlin finished seventh from Rossi and Kirkwood (from the back of the field).
Palou now leads the championship by 74 points.