Katy Perry performs during her "Witness" tour Sept. 19, 2017,...

Katy Perry performs during her "Witness" tour Sept. 19, 2017, in Montreal, Canada. Perry, 32, played Madison Square Garden on Monday, Oct. 1, 2017, along with opening act Noah Cyrus. Credit: Getty Images for AEG / Kevin Mazur

Katy Perry’s wild success is built on a mix of escapism and esteem-building, making her “Witness” show a much-needed tonic Monday night in the wake of the mass shooting at a Las Vegas concert.

The ramifications of that tragedy were on display at Madison Square Garden, as heightened security greeted concertgoers. Before opening act Noah Cyrus, the music was nothing but the hits of Tom Petty, who reportedly was taken off life support after suffering cardiac arrest on Monday.

However, once Perry took the stage, her goal was to make fans forget the world’s problems for a while. “Did you come here to have fun?” she asked after an upbeat version of the new song “Roulette,” which featured Perry and her dancers crawling around a pair of giant dice.

Perry, 32, did take a moment to acknowledge the Las Vegas deaths by wishing for world peace with Island, a 9-year-old girl from Long Island that she picked out of the crowd. “There’s a lot of people hurting tonight,” she said. “I know it’s been a tough day. But music is special. It’s magic . . . Music brings us together. It should never be a place of fear.”

Perry showed music’s power by my reinventing her hits. “E.T.” picked up a metallic stomp, while “Last Friday Night” became a Supremes song. “Hot N Cold” became an ’80s classic, mashed up with The Cure’s “Friday I’m in Love” and a bit of Devo’s “Whip It.” Best of all, Perry mashed up “California Girls” with Ready for the World’s “Oh Sheila.” The Minneapolis Sound appeared again when “Bon Appétit” merged into Janet Jackson’s “What Have You Done For Me Lately?”

Of course, Perry’s younger fans probably wouldn’t catch all these musical references (or, hopefully, the sexual innuendo of “Tsunami” and “Bon Appétit). But she kept them entertained by hovering over them on giant swings or replicas of Saturn, or bringing out Left Shark from her Super Bowl Halftime Show performance.

Perry, who returns to The Garden on Friday, is in the midst of some struggles. Though her “Witness” album debuted at No. 1, its singles haven’t clicked with radio the way Perry’s previous releases have. After all, she tied Michael Jackson’s seemingly unreachable record of sending five singles from the same album to No. 1, with her string of hits from 2010’s “Teenage Dream.”

But she’s taking some chances to give those songs a warmer welcome, like raising the tempo of “Chained to the Rhythm.” Not everything worked, but she did succeed in showing people a good time on what could’ve been a dark night.

SUBSCRIBE

Unlimited Digital AccessOnly 25¢for 6 months

ACT NOWSALE ENDS SOON | CANCEL ANYTIME