Nick Kyrgios put in a characteristically vocal performance, including complaining to the umpire that a fan was smoking marijuana, en route to the US Open third round.
The Wimbledon runner-up repeatedly berated his box as he beat French world number 50 Benjamin Bonzi 7-6 (7-3) 6-4 4-6 6-4.
The Australian swore several times and was given a warning in the third set.
Earlier in the day, Norway's fifth seed Casper Ruud beat Tim van Rijthoven.
The 23-year-old won 6-7 (4-7) 6-4 6-4 6-4 to reach the US Open third round for the second time and will face American 29th seed Tommy Paul.
"I'm just happy to get through," said Kyrgios, who plays American world number 87 JJ Wolf next.
"It's been a stressful time. Me and my team have big expectations. Every tournament I play I'm expected to play amazing tennis every time.
"I'd rather have that pressure and expectation to go far. I feel like I'm playing some of the best tennis of my life."
Fiery Kyrgios warned by umpire
Kyrgios got off to a flying start, breaking Bonzi's serve in the first game, but was broken himself three games later and began occasionally shouting and cursing at his team between points as has become his trademark.
An entertaining tie-break twice left Bonzi flat on his face on the floor as Kyrgios finished with a flourish, winning five points in a row to take it 7-3.
In the second set Kyrgios, who is facing legal action from a fan he said was "drunk out of her mind" at Wimbledon, said a member of the New York crowd was smoking marijuana.
The 27-year-old swore when explaining that to the umpire and added that it could harm players who suffered from asthma, as he does. As play resumed, the umpire asked spectators to "refrain from smoking around the court".
Despite his complaints, Kyrgios continued to play a high level of tennis, hitting lines and showing complete control of his drop shots to take set point on Bonzi's serve.
After he was broken to go 5-4 down in the third set, Kyrgios swore at his team at the change of ends, saying "go home if you're not going to support me" and received a warning for unsportsmanlike conduct as a result before losing the set.
He complained about fans leaving the stadium during play, before being broken in the third set but levelled things again in the next game.
The Australian faced three break points at 4-4, but saved them all and then broke himself as Bonzi found the net, roaring to the New York sky in celebration at his victory.
Elsewhere in the men's draw, American John Isner withdrew with injury from his second-round match, meaning Danish 28th seed Holger Rune advances and will play the winner of Thursday's match between Britain's Cameron Norrie and Portugal's Joao Sousa.