It’s a wonder Madonna was ever able to play in vast arenas and stadiums.

At the Golden Gate Theatre on Tuesday, Nov. 5, performing the final date of her three-night Madame X tour residency in San Francisco, the 61-year-old singer seemed to take note of every little distraction in the room: the light-up flower crown someone was wearing in the 18th row; the exit door on the left side of the building that opened and closed a few times when a couple people dared go to the restroom; even the murmurs coming from the darkest corners of the balcony.

“Don’t talk while I’m talking,” she snapped. Adding for good measure, “Don’t talk while I’m not talking.”

To be fair, she is Madonna – a pop icon, cultural shape-shifter, Rock and Roll Hall of Fame inductee, mother, hero, survivor and so much more. She’s someone whose perennial desire for control has carried her farther than any of her peers, making her the highest-charting female musician and highest-grossing female touring musician in history.

On Tuesday at the 2,297-capacity Golden Gate Theatre (the concert was originally scheduled for Oct. 31 but delayed due to production issues), Madonna was battling a cold, suffering from a torn ligament and had a bad knee (“and no hours of sleep,” she said), but she still put on a spectacular show.

It was rife with bawdy humor, attitude, sex, loads of swear words and references to her private parts — basically everything you want from a Madonna concert. She demanded the same level of effort from her audience, despite inexplicably sweltering temperatures inside the theatre.

“You’re kind of lazy — just putting that out there,” Madonna said, midway through the show. “It’s OK. Because I’m not.”

Scenes from Madonna’s Madame X tour.Photo: Stufish

Madonna didn’t need to wear a bedazzled patch over her left eye and cloak herself as Madame X. She didn’t need to play a late show on a school night at a small, overheated theater on a dreggy corner off Market Street. She didn’t need to run through a two-hour-plus set crammed with songs from a new album that nobody truly loves.

But Madonna is hardly one to do things the easy way. Rather than book huge tour stacked with hits, which is what most fans who grew up with her music would have most likely preferred, she is slogging her way across the country performing long residencies in small venues in select cities, focusing almost entirely on material from her 14th studio recording, the dark and disorienting “Madame X.”

“I have wanted to have this intimate experience with my audience for three decades,” she said on Tuesday.

Despite the close-up environment, fans got the full Madonna spectacle, complete with 41 musicians, singers and dancers; several costume changes and video vignettes; and a lone typewriter used to clack away epitaphs for the crowd (“Artists are here to disturb the peace,” read a recurring quote from James Baldwin).

The songs on “Madame X,” are all over the place, bouncing between trap, hip-hop, reggaeton, Latin pop and electronic dance music without quite falling, erm, into the groove. Thematically, the record is wide-reaching too – touching on the personal, political, spiritual, sensual and everything in between.

But on stage she brought it all together, highlighting infectious new songs like “Crazy” and “I Don’t Search I Find,” alongside few choice classics such as a faithful rendition of “Vogue,” a capella singalong of “Express Yourself” and a thunderous set-closing “Like A Prayer.”

Scenes from Madonna’s Madame X tour.Photo: Stufish

As she glided across the stage to the retro house groove of the recent single “Crave,” featuring Swae Lee, it become clear where Katy, Miley, Britney, Gaga and Gwen all got their moves and gumption.

For all her defiance, Madonna remains a devoted artist, who elevated each tune with a completely original production revolving around her touring ensemble and theatrical show built around a pair of movable staircases and variety of projections.

Madonna highlighted her family at every turn, featuring oldest daughter Lourdes, 23, dancing in a dramatic video clip accompanying “Frozen;” and employing 13-year-old Mercy and 7-year-old twins Stelle and Estere as part of her live dance crew (maybe a little bit past their appropriate bed times).

She exerted her sense of control to the audience experience, taking the stage a little after 11 p.m. and prohibiting the use of cell phones, smart watches and photography (including press, instead supplying a pair of blurry shots of the stage).

Since its release in June, “Madame X” has sold only 90,000 copies in the US, less than half its predecessor, 2015’s “Rebel Heart,” which moved nearly 250,000 copies (and roughly 9,910,000 fewer copies than her best-seller, 1984’s “Like a Virgin”).

This tour feels like Madonna’s attempt to reestablish herself from the ground up.

Once a wise-cracking pair of eyebrows inseparable from the attitude and energy of New York City, she has spent the past few years dividing her time between her manor in London and a mansion in the village of Sintra, Portugal, where her teenage son David Banda attends a prestigious soccer academy.

At one point in the concert she recreated (with a smidge of cultural appropriation) a Portuguese nightclub on the stage, for a segment that found her playing musical tourist through “Killers Who Are Partying,” a fado flavored cut from the “Madame X” album; a cover of “Sodade,” a song made famous by Cesaria Evora; and the harder-edged “Batuka,” which found her backed by an ensemble of batuque drummers and singers called Orquestra Batukadeiras.

“You won’t see this anywhere else, no siree,” she said.

For the encore song, “I Rise,” the screen behind her came alive with recent news footage of protests and marches in solidarity with the resist movement, but as Madonna sang the verses it became apparent that the song was as much about her as current events: “I managed to survive/ Freedom’s what you choose to do with what’s been done to you.”

The last standing icon from pop’s halcyon days (her closest contemporaries, Michael Jackson, Prince and George Michael each died young) Madonna not only remains alive but she is embracing every moment of her existence.

“Nobody is anybody’s bitch,” she said. “I can’t spell it out any clearer than that.”

She meant it.

More at SFChronicle.com