Early in the night at the 34th annual MTV Video Music Awards, the genial pop singer Ed Sheeran was in the middle of a sober performance of “Shape of You” when, quite jarringly, the impish rapper Lil Uzi Vert crept onstage and joined in. Soon, the men were performing Uzi’s dizzying “XO Tour Llif3,” Mr. Sheeran singing grimly and Lil Uzi Vert working the stage like a catwalk while bleating out his lyrics. In the audience, a camera caught the comically expressive rapper Cardi B with an Austin Powers-esque look of amused shock.

The first half of this year’s V.M.A.s ceremony — which was broadcast live on MTV Sunday night from the Forum, in Inglewood, Calif. — overflowed with moments like this, left-field tweaks of pop perfectionism: the host, Katy Perry, fitfully descending into the arena in a spacesuit; Lorde, apparently hobbled by the flu, using her stage time for a cheerful, casually choreographed dance routine; Miley Cyrus, singing about growing up, backed by dancers of a certain age dressed in 1950s “Grease” chic; and many more, coming quick, one after another.

But then another jarring transition happened: This show, which had been at its zany best, by far its most enjoyable installment in years, took a sharp turn to the political, and did not lose momentum.

Provocation has long been the coin of the realm at the V.M.A.s, but exactly what sort has changed with the times. In this climate, what that meant was outright decency and humanity. Here, the V.M.A.s took advantage of a captive audience, dosing them with a wacky pop cornucopia, then delivering a series of powerful messages.