Wayne T. Carr portrays the seaborne title character in "Pericles" at Folger Theatre. (Jenny Graham)

“Pericles” begins as a so-so play that — presto! — turns into a far better one, a transformation achieved satisfyingly by Folger Theatre’s gently melodic and ever more persuasive presentation of an eternally-puzzled-over work.

The magic happens after Shakespeare’s stamp on the proceedings becomes apparent, spottily in the early portions of the play and then powerfully in the latter stages. In the climactic reunion scene, in fact, when Pericles, depleted by grief, discovers the child he thought was lost to him, the play records one of the most surefire, heart-poundingly emotional moments in the entire canon.

It’s generally accepted that “Pericles” is not entirely by Shakespeare’s hand, that he had little to do with the crude construction of the early passages of the story, a seafaring tale of stormy exile that takes its hero — portrayed here enjoyably by Wayne T. Carr — to one exotic Mediterranean or Aegean port after another. You can sense some of the language deficits in the underwhelming initial scenes of director Joseph Haj’s production, exported to Folger from the Oregon Shakespeare Festival; the actors struggle mightily in the early going to breathe some life into what come across as stiff characters and choppy poetry.

Smartly, though, Haj and composer-lyricist Jack Herrick smooth over some of the rough patches by setting verse to music, and in other places, inserting sea shanties and other original melodies. (We’re halfway to “Pericles! The Musical.”) The musicality starts with the inviting presence of narrator Gower (Armando Duran, decked out like a beachcombing hippie) crooning his prologue to the accompaniment of flute and guitar and flows all through the comic and sentimental interludes that follow.

The informed conjecture goes that Shakespeare either took over the project or reworked the text of some other writer, whose identity remains unclear. In any case, his signature comes to the fore by the evening’s midpoint and certainly by the time of the wonderful brothel scenes in Mytilene, where Pericles’s kidnapped daughter Marina (the astute and tender Jennie Greenberry) by dint of charm and resolve goes about reforming an entire decadent city.

“Pericles” employs plot devices that show up in other of Shakespeare’s tragicomedies, including “The Winter’s Tale,” “Measure for Measure” and “The Merchant of Venice.” But this play reverberates in singular ways, too, particularly in its intense focus on parents and children. The hero is a guest at the courts of kings whose relationships to their daughters are depraved, as in the case of the incestuous Antiochus (Scott Ripley); and of insanely jealous queens like Dionyza (Brooke Parks), who order the deaths of girls perceived as threats to their own daughters. More admirable paternal figures materialize, too, as at the court of Pentapolis, where benevolent King Simonides (Ripley, again) steers his daughter Thaisa (Parks, again) into Pericles’s princely arms. And of course, it is the enduring bond between Marina and her parents, severed by fate, that holds the whole play together.

The last major staging of “Pericles” in these parts occurred more than a decade ago, in a version at Shakespeare Theatre Company by director Mary Zimmerman that applied an alluring storybook veneer to the myriad sites of Pericles’s adventures. Haj, who recently succeeded Joe Dowling as artistic director of the Guthrie Theater in Minneapolis, brings a more pared-down visual style, and, winningly, a more robust emotionality, to “Pericles.” Set designer Jan Chambers works in concert here with video designer Francesca Talenti to conjure angry sea squalls via a swinging platform and a projection of galloping ocean waves; in other instances, a backdrop darkens to reveal a lovely starry canopy in the night sky, out of which a gracious god like Diana (Emily Serdahl) can propitiously appear.

Costume designer Raquel Barreto, meanwhile, dresses the actors in what might be described as enchanted resort wear: flowy dresses and stark white pants and tunics and vestments that glitter in the moody Mediterranean daylight, illuminated by Rui Rita. (One nagging question: could a better job be done of disguising the wig caps on the elaborate hair pieces worn by many of the actors?)

Pericles sails into ports abounding in both good and evil; on this occasion, the good really do triumph, acting-wise. Greenberry’s vivacious turn as Marina helps cement the production’s compassionate tone; in that vein, Barzin Akhavan proves a first-rate Cerimon, the sorcerer-lord who brings Pericles’s wife back from the dead, while Parks brings a becomingly sweet steeliness to her portrayal of Thaisa. Michael J. Hume does nicely by Pericles’s right-hand man, Helicanus. His donning of women’s clothing to become the madam of the brothel in Mytilene is suitably cartoonish, but does it feel to you as it does to me that this kind of Shakespearean shtick has run its course?

At the center of all things “Pericles” is Carr, who matures advantageously in the role, as time marches inexorably on. Indeed, when Pericles is old and gray, and Marina and Thaisa are back in his embrace, the play acquires its most moving and memorable colors.

Pericles, by William Shakespeare. Directed by Joseph Haj. Set, Jan Chambers; music and lyrics, Jack Herrick; costumes, Raquel Barreto; lighting, Rui Rita; sound, Amadon Jaeger; videos, Francesca Talenti; movement, Sarah Lozoff. With Michael Gabriel Goodfriend, U. Jonathan Toppo. About 2 hours 20 minutes. Tickets, $35-$75. Through Dec. 20 at Folger Theatre, 201 E. Capitol St. SE. Visit www.folger.edu/theatre or call 202-544-7077.