By the time the gun-toting nuns make an appearance, you may find that you’re out of belly laughs. Rally those abs, if possible, because there is more fun to come in the brisk (90 minutes!) and buoyant production of “The Comedy of Errors” at the Delacorte Theater in Central Park, with the sterling team of Hamish Linklater and Jesse Tyler Ferguson doubling down as Shakespeare’s two sets of long-lost twins.

Those plays are all justly acknowledged as among Shakespeare’s finest. “The Comedy of Errors”? Perhaps not. One of his earliest works, this boisterous farce about mistaken identities plays lightly with themes — estrangement, injustice, infidelity — that will later be more deeply explored. Lacking the psychological depth of mature Shakespeare, the play in performance is often lowered further with an emphasis on galumphing physical comedy that makes you pine for the delicacies of the Three Stooges.

Image

The Comedy of Errors From left, Reed Campbell, Hamish Linklater and Jesse Tyler Ferguson in this comedy at the Delacorte Theater.CreditSara Krulwich/The New York Times

Yet without stinting on the knockabout humor — at one point a plate of spaghetti is plopped atop Mr. Ferguson’s head — Mr. Sullivan and his top-to-bottom terrific cast have brought enriching measures of warmth and style to this oft-undervalued play. The denouement, in which the pairs of estranged brothers are reunited, unexpectedly gives off some of the emotional heat of the scenes of recognition and reconciliation in Shakespeare’s greater comedies and romances.

But let’s get back to those gun-toting nuns. Mr. Sullivan has set the play in upstate New York in the 1940s, adorning the scene changes with jitterbugging couples flinging their limbs in the air to the strains of big-band music. (Classic tunes like “Stompin’ at the Savoy” are featured in a preshow dance sequence, and Greg Pliska supplies a skillful pastiche from the same era.) The vibrant choreography is by Mimi Lieber; natty costumes by Toni-Leslie James perfectly match the colorful sets by John Lee Beatty, who tips a hat to Edward Hopper in the backdrop.

Ephesus here becomes a frisky but dangerous urban playground presided over by the Duke (Skip Sudduth), whose thick Brooklynese amusingly draws a line between Shakespeare’s verse and the musical dialogue of Damon Runyon’s merry crooks of “Guys and Dolls” fame. Moving with the rolling gait of a mob kingpin, and attired in a black pinstriped suit, Mr. Sudduth’s Duke dispenses the rough justice that rules in Ephesus with the air of a man who loftily regrets the murder that the city’s codes of honor require him to enforce.

Image

A scene from the Shakespeare in the Park production of “The Comedy of Errors,” directed by Daniel Sullivan, which is set in the 1940s in upstate New York.CreditSara Krulwich/The New York Times

His victim is Egeon (the fine Jonathan Hadary), a merchant from Syracuse, whose citizens risk death by setting foot in Ephesus. In an early indication that Mr. Sullivan will find surprising seams of fresh humor in the play, Egeon’s long-winded expository monologue — setting forth the bizarre circumstances that separated his twin sons and their twin attendants — is enlivened by a hilarious puppet show featuring props pulled from a bottomless suitcase. (The Duke’s fedora-wearing minions defensively pull out their firearms when Egeon pops open the case.)

The fireworks really begin when Egeon’s son Antipholus of Syracuse (Mr. Linklater) arrives in search of his twin, in the company of his trusty attendant Dromio (Mr. Ferguson). It is not long before these two have become hopelessly and hilariously confused with their counterparts living in Ephesus, resulting in an involved series of outrages and apparent betrayals that find the visitors dazed and confused by the sorcery practiced by the city’s citizens, and the local Antipholus and Dromio aflame with anger at the peculiar behavior of friends and neighbors.

Mr. Linklater and Mr. Ferguson leap nimbly between their roles, neatly differentiating the twins and making the small signifiers indicating who’s who (differently colored bands on their hats, primarily) almost unnecessary. Mr. Linklater’s gracious Antipholus of Syracuse moves from indignation at Dromio’s apparent duplicity (it’s the wrong Dromio, of course) to punch-drunk wonder when Adriana (Emily Bergl, delightfully evoking a gum-cracking Gloria Grahame), his twin’s wife, drags him home to dinner. Finding his own house barred to him when he arrives for the same meal, Mr. Linklater’s more rough-hewed Antipholus of Ephesus hurls himself at the locked door in a highly gymnastic expression of irritation.

Image

From left: Jesse Tyler Ferguson, Heidi Schreck, Emily Bergl and Hamish Linklater in the Shakespeare in the Park production of "The Comedy of Errors."CreditSara Krulwich/The New York Times

As the two Dromios (Dromii?), Mr. Ferguson has the most ripely funny roles, in particular the visiting servant, whose horror at the romantic attentions of Adriana’s kitchen maid provides the production with its delectable high point. A skilled stage actor and, like Mr. Linklater, a Shakespeare in the Park veteran, Mr. Ferguson is now best known as a star of the television series “Modern Family.” A natural imp with a clown’s expressive face, he turns Dromio’s string of geographical metaphors describing the ample figure of this aggressively lustful wench into a rollicking comic set piece. Often I’ve found myself crying for mercy when Shakespeare’s characters engage in elbow-in-the-ribs ribaldry; with Mr. Ferguson’s impeccable phrasing and timing, I would have been happy for it to last longer.

But the frothy high spirits occasionally, and rewardingly, make room for moments of more gentle pleasure. Mr. Linklater’s ardent confession of his affection for Adriana’s sister, Luciana (Heidi Schreck), echoes a theme that recurs throughout Shakespeare’s comedies: the lightning quickness with which love can strike. Ms. Schreck’s brisk declension, from outrage to sly satisfaction, underscores the quicksilver changes in feeling that are also a hallmark of the comedies.

As the local courtesan, De’Adre Aziza radiates steamy sex appeal in her brief appearances and delivers a jazzy rendition of “Sigh No More” (from “Much Ado About Nothing”) with supple vocal allure.

I never quite got back to those gun-toting nuns, did I? They accompany the Abbess, played with bustling firmness by the veteran Becky Ann Baker, who arrives in the final scenes to sort out all the confusion. Because only two actors are playing the four central roles (they are usually doled out to pairs of approximate look-alikes), the production generates some nifty suspense.

How will four characters share the stage when there are only two actors? With a few textual trims, Mr. Sullivan and his performers bring off this feat with an ease that, by this point, hardly surprises. And it is fitting that this comedy, in which the dark art of magic is often evoked to explain people’s peculiarities, should charm us, in the final moments, with some deft theatrical sleight of hand.