When Miss Congeniality goes up against Miss Vulgarity, can there be a doubt about who’s going to win?

As a tightly wound FBI agent in “The Heat,” Sandra Bullock gamely jousts for attention with Melissa McCarthy’s coarse, Boston-Irish detective. But from the moment she barrels onto the scene like a cannonball of crudity, McCarthy makes it clear that this movie is hers to make or break. And she knocks it right out of Fenway Park, with a big assist from director Paul Feig, who previously brought out her Oscar-nominated best in “Bridesmaids.”

Agent Sarah Ashburn (Bullock) is cocky and in control until she’s teamed with Detective Shannon Mullins (McCarthy), a cursing hellion in sweatpants and black fingerless gloves, to take down a drug kingpin. It’s the old class-meets-crass setup of many a buddy-cop movie, but what makes it fresh is McCarthy’s freestyle fearlessness.

She pulls off antics that would draw groans, if not bristles of offense, in anyone else’s hands — taking down a perp who is black by beaning him with a watermelon, insulting an albino. Mullins, whose m.o. is “shoot off mouth first, ask questions later,” doesn’t bother to open her piehole unless she’s spitting out something shocking. Like a live-stream of the id run amok, she induces as many gasps of the “Oh, no, she didn’t” kind as she does belly laughs.

The plot is as clichéd as they come, but relying on that is missing the point. The chemistry between Bullock and McCarthy as they go from adversaries to loyal pals is the story worth watching. They’re as tough as any male pairing of the genre — Gibson and Glover in “Lethal Weapon,” Murphy and Nolte in “48 Hours” — but they bring a strong “girlfriends” feeling to the table. They can get blind drunk on Jägermeister shots in a dive bar and take a knife in the leg like champs, but they also argue about Spanx and barrettes, and discuss choosing career over marriage and kids. That conversation is refreshingly brief; this movie is about friendship, not romance.

Though it often seems as if McCarthy and Bullock are ad-libbing their lines, the script is an impressive feature-film debut for writer Katie Dippold, whose TV credits are “Parks & Recreation” and “MADtv.” The action flat-lines at several points, but that’s offset by an endless parade of small roles and cameos from familiar funny faces including Michael McDonald, Marlon Wayans and Jane Curtin. Even Ben Falcone (McCarthy’s husband, better known around here as the weird music teacher in those Target denim commercials from a couple of years ago) makes a momentary appearance as a lovelorn former suitor. Further reinforcements come from Mullins’ caricature of a family, complete with a Great Dane named Kevin Garnett and tacky paintings blending Jesus and sports.

Amid buzz that “The Heat 2” is already in the works, what’s most notable about the original is that it stars two over-40 women actors and it’s not a rom-com. That calls for a shot of Jäger.