Like its lead character Guy Trilby, this first directorial effort from Jason Bateman (who also stars) is foul-mouthed but sweet underneath. If vulgar language doesn’t offend you overmuch, you’ll find “Bad Words” an engagingly off-color way to spend an hour-and-a-half.

Andrew Dodge’s script spoofs such well-meaning movies about spelling contests as “Spellbound” and “Akeelah and the Bee.” Bateman’s Trilby is an intense, acerbic forty-year old proofreader who takes advantage of the clumsily written rules for the national Golden Quills competition to become a contestant. The first act shows him joining the elementary-school children on stage at a regional event, creaming the kids not only with his knowledge but his penchant for putting them down and psyching them out. When confronted by infuriated parents, he responds with withering insults before being spirited off by Jenny (Kathryn Hahn), a reporter serving as his sponsor while researching an article on him—and more than willing to join him in the sack while doing so.

Before long Guy’s at the national finals in Los Angeles, a hallowed event presided over by officious Bernice Deagan (Allison Janney), who makes it her mission to drive Trilby away using whatever means are at her disposal, underhanded or not—she even sees to it that he’s assigned a supply closet as his motel room. One can understand her rage: not only is the competition her baby, but parents—like the irate Mrs. Tai (Rachael Harris)—who have been driving their offspring to win are growing increasingly angry, and Deagan is operating under the watchful eye of Dr. Bowman (Philip Baker Hall), the distinguished academic who founded the event and is serving as a TV commentator for it.

Even more consequential is the effort of one of the other contestants, little Chaitanya Chopra (Rohan Chand), to bond with Trilby, who initially brushes him off with his customary abruptness but rethinks his attitude when he learns that the boy enjoys a nice room, complete with a mini-bar, without benefit of a chaperone. Before long Guy is lounging in the kid’s bed and putting up with his incessantly bubbly chatter. He responds by taking Chaitanya out for a night on the town and teaching him all sorts of bad habits. It’s here that the movie slips into sentimental mode, at least to some extent, thanks to Chand’s undeniable charm and Bateman’s ability to show a touch of tenderness beneath Guy’s caustic armor. But the comic bite is never too distant, returning in a nice narrative twist.

“Bad Words” eventually reveals all—Trilby’s motivation in trying to destroy the Golden Quills, the reason behind Chaitanya’s cultivation of him, the ultimate outcome of the contest—in ways that are a mite too tidy and conventional, in screenwriting terms. But the expertise of Janney and Hall helps to put the material across even when it gets saccharine or contrived, and Chand’s ingratiating presence never turns into mere sitcom squishiness. Hahn is hampered by a pretty thankless role, though she puts it across as well as can be expected, and the supporting cast (including other spellers whom Trilby mercilessly demolishes, as well as the contest’s bank of announcers and lesser officials) is excellent. Ken Sang’s cinematography, Tatiana S. Riegel’s editing and Rolf Kent’s score add to the professional feel.

In the end, though, “Bad Words” is Bateman’s film, no less for the skill he shows in giving the ensemble work spit and polish, but for the note of gleeful nastiness he brings to Dodge’s stream of brutal invective. Abandoning his usual persona of befuddled niceness, he recaptures the sense of cunning he first exhibited on his unsuccessful eighties sitcom “It’s Your Move,” and it works beautifully here even when his character evinces a Twinkies-style marshmallow center.

One can imagine the material being taken in a darker direction than Dodge and Bateman’s, but if the movie isn’t as uncompromising as it might have been, it’s still has a satisfying quotient of sourness to go along with the sweet.