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 France's 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.
World number one and defending champion Daniil Medvedev also won as he beat Arthur Rinderknech 6-2 7-5 6-3.
His next opponent will be Wu Yibing, who earned a 6-7 (3-7) 7-6 (7-4) 4-6 6-4 6-4 win over Nuno Borges of Portugal to became the first Chinese player to reach the third round at the US Open.
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 round three for the second time and will face American 29th seed Tommy Paul.
Kyrgios will play American world number 87 JJ Wolf in the next round.
"I'm just happy to get through," said Kyrgios.
"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."
Kyrgios got off to a flying start, breaking world number 50 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.
"People don't know I'm a heavy asthmatic," said Kyrgios after the match.
"When I'm running side to side, I'm struggling to breathe, [it's] probably not something I want to be breathing in between points."
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.