If recent misfires like “Tammy” and “Identity Thief” have proved anything, it’s that Melissa McCarthy is virtually indestructible, retaining her comic buoyancy, her tremendous likability and much of her fan base even when stuck with bargain-basement material. All of which makes it even more gratifying to see what she can do with a vehicle that’s firing on all cylinders for a change. In “Spy,” an uproarious blast of globe-trotting action-comedy delirium that doesn’t spoof the espionage-thriller genre so much as drop a series of banana peels in its path, McCarthy plays an eager-to-please desk jockey turned full-blown CIA operative who learns to wield a gun as skillfully as she does a one-liner — a dazzling transformation that represents the actress’s smartest, funniest, most versatile and fully sustained bigscreen showcase to date. Unsurprisingly, her key collaborator here is once again Paul Feig, who directed her to such show-stopping effect in “Bridesmaids” and “The Heat,” and Fox’s June 5 release will more than earn its place in the company of those past summer hits.

If “The Heat” (2013) placed its righteous gender politics front and center, pairing McCarthy with Sandra Bullock as a happy corrective to the male-dominated buddy-comedy tradition, then “Spy,” a vastly richer and more intricately conceived piece of work, succeeds in scoring a subtler representational coup. To call it feminist would hardly be inaccurate, but it might risk diminishing the singularity of McCarthy’s achievement: It’s not every woman (and certainly not every man) who can juggle the often-conflicting priorities of action and comedy as skillfully as she does here. Put another way, it’s hard to think of another performer, male or female, who could leap onto a motorcycle and immediately topple over sideways, and pull off the gag with such fumbling precision — or is it precise fumbling? — that it can only be described as graceful.

Admittedly, Susan Cooper (McCarthy), a fortysomething analyst stuck behind a desk in a vermin-ridden basement at CIA headquarters, doesn’t seem wired for action at first. The film opens with an extended combat sequence in Bulgaria, where a suave James Bond type named Bradley Fine (Jude Law) blows away a series of thugs as he tries to locate a nuclear bomb. His secret weapon, however, turns out to be Susan, who communicates with Fine via hidden earpiece, using all manner of high-tech surveillance equipment to maneuver him past every obstacle and enemy assailant. It’s a highly effective working relationship, albeit one that invariably leaves the hard-working Susan feeling more like a secretary or assistant than an equal, never mind that she has years of successful field training under her belt. It doesn’t help that she’s nursing a major unrequited crush on Fine, who, much like everyone else, looks at her and sees a single, middle-aged, overweight loner whose Agency career has probably already peaked.

But when Fine is suddenly assassinated by a haughty Bulgarian arms dealer named Rayna Boyanov (Rose Byrne), who somehow knows the identities of all the CIA’s top operatives, Susan becomes determined to enter the field herself for the first time and avenge her partner’s death, arguing that she’s the only one who won’t be recognized. Against the protests of surly agent Richard Ford (Jason Statham, hilariously sending up his meathead persona), the Agency chief (Allison Janney) reluctantly agrees, though she forbids Susan to put herself in harm’s way and sends her to Paris on a basic track-and-report mission. Should her intel prove valuable, it could lead them not only to Rayna but also to Sergio De Luca (Bobby Cannavale), a greasy-haired terrorist who’s trying to acquire the nuke for his own nefarious, loosely Al Qaeda-related reasons. (The plot, outlined here at lightning speed, never makes more sense than it has to.)

Feig’s beautifully structured, zinger-stuffed screenplay mines no shortage of amusement from the spectacle of Susan being briefed and prepped for duty: The Agency’s resident Q type fills her purse with high-tech gadgets, all sadly disguised as items that a woman like her would carry (hemorrhoid patches, stool softeners, etc.). Meanwhile, every phony alias and passport she’s assigned is invariably that of some frumpy Midwestern tourist; as Susan notes, “I look like someone’s homophobic aunt.” The comedy here has a shrewd double edge: On a certain level, Feig and McCarthy may well be inviting us to laugh at the sight of Susan in a bouffant wig and an oversized cat T-shirt, but they’re also taking deliberate aim at the sort of mentality that would write her off as a hopelessly unattractive loser in the first place.

Eventually, Susan’s mission takes her from Paris to Rome to Budapest — guided via earpierce by her easily excitable colleague Nancy (the delightfully dithering Miranda Hart), and accompanied much of the time by an overly amorous Italian associate, Aldo (British actor Peter Serafinowicz). Eventually Susan is required to drop the ugly-American guise and pass herself off as Rayna’s personal bodyguard — an inspired masquerade that necessitates the sort of radiant physical makeover that, between this and “Identity Thief,” might well become a semi-regular Melissa McCarthy movie trope. More crucially, however, it allows the actress’s head-butting, expletive-hurling, take-no-prisoners personality to emerge in full force, as Susan puts aside her earlier timidity and taps into the inner core of rage that, as neatly foreshadowed in the script, once made her one of the CIA’s most promising (and vicious) trainees before she was sidelined into a desk job.

Whether she’s dangling from the bottom of a helicopter, slamming a metal pot over the head of a knife-wielding assassin (Bollywood actress Nargis Fakhri), vomiting in disbelief over the corpse of a henchman she’s just eliminated, or kicking the crap out of some “Swedish motherf—er” just for the hell of it, McCarthy’s performance is a never-ending succession of priceless moments. For all her strengths as a verbal and physical performer, there’s a real core of emotion here, too; remarkably, she manages to pull all these disparate extremes of violence and comedy into a stirring, coherent portrait of a woman motivated by love, loyalty and a courageous if unrealized sense of her own inner worth.

For some, the term “action-comedy hybrid” may trigger dire memories of earlier studio mediocrities like “Knight and Day,” “Killers” and “The Bounty Hunter,” in which the two genres blended about as harmoniously as oil and water. By contrast, “Spy” gets the balance almost exactly right, predicated on the eminently sensible notion that a well-timed verbal jab can help punch up an action scene, while a high-speed car chase can only be improved with some discreet breast groping. Even when the violence catches you off guard with its sudden ferocity, it works in no small part because Feig, avoiding the surreal silliness of an “Austin Powers”-style sendup, maintains a surprisingly straight face even as he pursues a humorously skewed angle on the world of international espionage.

In keeping with this approach, the actors have mastered the art of inhabiting two different worlds simultaneously, tossing off even their funnier lines without breaking character. Having emerged as a comedic powerhouse in “Bridesmaids” and “Neighbors,” Byrne is no less brilliant here with her crimson lips, mile-high coiffure and supreme hauteur. Statham’s Ford, staying out of the action spotlight for a change, is mainly on hand to perform an ongoing riff in which he tries to convince Susan she’s not cut out for the job, rattling off various examples of his own tolerance for extreme pain (i.e., having to sew one arm back on with the other) that could well have been ripped from the many indifferent shoot-’em-ups littering his resume. Law, clearly having fun playing Bond for a day, brings an extra shot of star power to the across-the-board superb supporting cast.

The film’s scenic international locations and spy-thriller orientation have called forth a much higher level of technical polish than usual for a studio comedy, as evidenced by d.p. Robert Yeoman’s slick lensing, Jefferson Sage’s elaborate production design, a sexy-satirical Bond-style opening credits sequence, and action scenes of startlingly visceral impact (some of them achieved with some noticeable digital tweaking). The print reviewed at SXSW didn’t include closing credits, leaving an incomplete running time of 115 minutes.