You might have thought that spoofs of the James Bond formula had been done to death, but Paul Feig and Melissa McCarthy prove that there’s life in the old genre yet with “Spy,” a broad but funny farce played with such machine-gun rapidity that you don’t have the time to groan over a gag that doesn’t work before one that does pops up. It’s an action comedy in which the comedy is frankly better than the action, but there’s more than enough of it to compensate for that.

McCarthy, who had her breakout role working with Feig in “Bridesmaids” and moved up to co-star billing for him in “The Heat,” shows real versatility here as Susan Cooper, a CIA agent who serves as an analyst at Langley rather than in the field. Her main role is to oversee via computer screen the exploits of supercool operative Bradley Fine (Jude Law), on whom she has a not-so-secret crush. Using all sorts of high-tech equipment, she can see whatever he does while on assignment, warn him of approaching danger just in time for him to evade or eliminate the scads of bad guys pursuing him, and even call in drone strikes when necessary to save his hide. She also picks up his dry cleaning and mows his lawn, while he treats her as a chubby pal rather than a potential romantic partner. But while her equally office-bound colleague Nancy (Miranda Hart) might take blundering offense over how they’re treated by the likes of Fine and his colleague Karen Walker (Morena Baccarin), Susan is content to play the doormat, especially when confronted by witheringly uncompromising Deputy Director Crocker (Allison Janney).

Unfortunately, in his latest mission Fine accidentally kills a malevolent Bulgarian arms dealer named Boyanov (Raad Rawi) who’s stolen a nuclear device and is hawking it on the black market. Now the agency’s only hope of recovering the bomb is via the dead man’s daughter Rayna (Rose Byrne). But when Fine ventures into her estate, she kills him in Cooper’s view, in the process dropping the information that she somehow knows the identities of all the top CIA field agents. Though wild man operative Richard Ford (Jason Statham) still wants to go after her, Susan offers to take on the assignment as somebody who won’t be recognized, and Crocker reluctantly agrees.

That leads to a succession of European adventures that will pit Cooper against not only Rayna but also a bomber (Julian Miller), an assassin named Lia (Nargis Fakhri), and Sergio De Luca (Bobby Cannavale), who’s acting as Boyanov’s middleman in the projected sale but, as it turns out, has an agenda of his own. She’ll have assistance along the way from some other agency folk—most notably a lascivious Italian named Aldo (Peter Serafinowicz) and nervous Nancy, who’s sent into the field for the first time, too. On the other hand, encounters with Walker, Ford and a third operative whose identity won’t be revealed here (but comes as much less of a surprise that Feig probably hoped) prove more troublesome than helpful.

McCarthy transitions easily from the put-upon glorified secretary of the first act to the increasingly capable, though always squeamish, agent of the later reels. Her comic timing is spot-on, and she’s the beneficiary of plenty of crisp comic material from Feig—like the goofy collection of special equipment she’s provided with by the agency’s equivalent of M and the succession of uncomplimentary aliases she’s given with each new stop on her journey. The action sequences are reasonably well choreographed, but they’re clearly not the director’s forte: McCarthy’s one-on-one fights with the bomber and Lia, as well as the closing one with Sergio’s men, go on too long and include some needless unpleasantness (cracking bones, and a vomit joke that could easily have been excised); and a chase scene involving a motorcycle, as well as a helicopter sequence at the close, show some mediocre process shots. Still, the comedy makes up for the stumbles in the action department, though some of the scatological bits might have been jettisoned—though such pandering to the audience’s baser instincts is apparently obligatory nowadays.

That’s due not only to McCarthy, but a stellar supporting cast. Law has fun sending up his James Bondish persona, and Janney puts across Crocker’s hard-boiled aggression. But their contributions pale beside those of Byrne, who delivers Rayna’s archly insulting jibes with perfect pitch (and looks great); Cannavale, who gives a nutty edge to Sergio’s villainy; Hart, who carries off her nervous Nelly routine deliciously; and Serafinowicz, who makes Aldo’s Italianate lustfulness almost lovable. Best of all, amazingly enough, is Statham, who delivers Ford’s self-aggrandizing rants with a verbal aplomb one would never have expected of him. His end-credits bit with McCarthy, though, doesn’t work terribly well.

Throughout the technical credits are first-rate, with cinematographer Robert Yeoman (who also shot this week’s other opening “Love & Money” in a very different style) luxuriating in the European location shots in places like Paris and Rome as well as the interiors fashioned by production designer Jefferson Sage, the art direction team headed by Tom Brown and set decorator Kelly Berry (including the CIA’s vermin-infested office, a repeated gag that works surprisingly well). Christine Bieselin Clark contributes a great array of costumes for both McCarthy and Byrne, some gorgeous and others (like those for Cooper’s alter-egos) deliberately unflattering, and Theodore Shapiro’s score avoids italicizing things overmuch. The opening credits sequence is a nifty copy of the old Bond ones.

“Spy” proves a top-notch vehicle for McCarthy, but though she’s clearly the linchpin, it’s not a one-woman show—and is all the better for it.