Phillipa Soo and Lin-Manuel Miranda in “Hamilton,” with book, music, and lyrics by Lin-Manuel Miranda, at the Public Theater. (Joan Marcus/Joan Marcus)

Lin-Manuel Miranda is showing us the way. To anyone who might suggest musical theater has hit a creative dead end, the actor-songwriter unfolds a spectacularly persuasive counter­argument in the myriad melodious ­masterstrokes of “Hamilton.”

He has transformed the biography of one of America’s Founding Fathers, Alexander Hamilton, into a merry, extravagantly annotated hip-hop operetta. He has dexterously preserved, through the dense, curlicuing lyrics of rap and other musical motifs, all of the intense currents in Hamilton’s turbulent and eventful life, one that ended in that notorious duel with Aaron Burr in 1804, on a bluff overlooking New York City.

You get the feeling, courtesy of “Hamilton,” which had its official opening Tuesday night at off-Broadway’s Public Theater, that the nation’s first Treasury secretary would have deemed it fitting that we find his name and likeness not only on a $10 bill, but on a New York marquee as well. And for the world to see him — through the eyes and in the guise of Miranda himself — as the evocation of what America was, and still can be. It’s gratifying to discover that at the intersection of scholarship and showmanship there exists a consoling affirmation of how we’re all in this together.

Miranda and director Thomas Kail — his college friend and collaborator on the 2008 Broadway musical “In the Heights” — assert through this musical that Hamilton’s tale, the tale of the country’s beginnings, is the birthright of everyone here right now. The cast is black, white, Latino and Asian, and while there is nothing revolutionary about that these days, something deeply moving results from the powerful claim these young actors place on America’s origin story, in the connections they forge afresh to people and events that often go stale in history texts and classes.

Make no mistake: “Hamilton” is indeed a history lesson, and the jaw-dropping reams of detail Miranda packs into the 34 musical numbers (plus reprises!) do walk right up to the edge of overkill. (The show is inspired by Ron Chernow’s 818-page best-selling biography.) But such is the exhilarating level of theatricality exhibited here, in everything from Andy Blankenbuehler’s supercharged choreography to Howell Binkley’s marvelous lighting to the magnetic portrayals of Hamilton, Burr (Leslie Odom Jr.) and Thomas Jefferson (Daveed Diggs), among others, that the musical’s 2 hours and 45 minutes whizz and swirl by in a captivating rush.

Superb turns are also contributed by Phillipa Soo, as Eliza Schuyler, the wealthy young socialite who becomes Hamilton’s wife, and Renée Elise Goldsberry as her sister, Angelica, who loves him just as ardently. Their rendition of the swooningly romantic “Helpless” stamps it as an instant pop classic. Brian d’Arcy James, meanwhile, makes a smashing impression as the musical’s royal foil, England’s King George III, delivering in “You’ll Be Back” a hilariously cynical commentary on the upstart antics of his rebellious Colonial subjects.

The handiwork here is also proof positive of the reassuring resilience of the American musical and how marvelously adaptable, in capable hands, the form remains. Drawing on such varied influences as rap, pop, jazz and Broadway standards — and the vocabularies of ­Tupac Shakur, the Beatles and Gilbert and Sullivan — “Hamilton” is as smart about music as it is about the American Revolution. Along with “Wicked,” the all-time tweener sensation, and the perfectly irreverent “The Book of Mormon,” “Hamilton” will be talked about in years to come as a benchmark experience, one that opened the eyes of other theater-makers to new possibilities.

“Hamilton” owes a debt, too, to musicals that have come before: Stephen Sondheim and John Weidman’s “Pacific Overtures,” which retells from a Japanese perspective the history of Admiral Perry’s arrival on Japanese shores, comes to mind. So does “Spring Awakening,” ­Steven Sater and Duncan Sheik’s translation into rock of Frank Wedekind’s 19th-century play about repressed German teens. In “Hamilton,” Miranda, who has written the book, music and lyrics, establishes more profoundly than ever before the credentials of rap as a conveyance for musical theater. In fact, he makes a case for it as a natural language for the thoughts and ideas spewing nonstop from Hamilton’s head.

The musical is a straightforward account of Hamilton’s life, taking us from his arrival in New York — of his status as an immigrant from the West Indies, we are reminded again and again — to that last confrontation with Burr in Weehawken, N.J. We follow along as his fortunes rise, thanks to his role as right-hand man to Gen. George Washington (Christopher Jackson) and to his skills as a designer of U.S. government. And we watch as his appetites lead him to scandal, in the exposure of his affair with a young married woman, Maria Reynolds (Jasmine Cephas Jones).

It’s all here, in a breathtaking pageant. The creative energy Miranda infuses into “Hamilton” is on a par with the manic spirit of his subject. It’s a dynamite ride, just trying to keep up with both of them.

Hamilton

Book, music and lyrics by Lin-Manuel Miranda. Directed by Thomas Kail. Choreography, Andy Blankenbuehler; set, David Korins; costumes, Paul Tazewell; lighting, Howell Binkley; sound, Nevin Steinberg; orchestrations, Alex Lacamoire. With Okieriete Onaodowan; Anthony Ramos; Christopher Jackson. About 2 hours 45 minutes. Through May 3 at Public Theater, 425 Lafayette St., New York. $20-$150, but the run is virtually sold out. publictheater.org or 212-967-7555.