“The Last Five Years” is a musical that really understands falling in, and out of, love.

It gets that annoying situation when you’re trying to demonize an ex, but the unwelcome memory of a happy time intrudes. It gets the thing where everything is going great but you suddenly remember that you secretly think you don’t deserve love. And it gets that uneasy feeling that perhaps romances, even good ones, aren’t meant to last.

Those moments come rushing at theatergoers all at once in Jason Robert Brown’s deceptively simple dramedy, which became a cult movie starring Anna Kendrick and Jeremy Jordan.

It’s just two archetypal characters, writer Jamie (Ryan London Levin) and actor Catherine (Aly Westberg O’Keeffe), who are married. Or were. The first line of the show, which is nearly all sung, is “Jamie is over and Jamie is gone.” From there, “The Last Five Years” alternates between songs by the two characters, whose stories proceed on parallel tracks.

Catherine sings the story of their five-year romance in reverse, from breakup to meet-cute, while Jamie relates it chronologically, from falling in love, to doubts, to dissolution. The only real duet comes during a marriage proposal at the show’s midpoint.

A perfect wedding of form to content, the show’s structure means the good times and the bad times are all mixed together — and, although this is a story with an unhappy ending, Catherine’s reversed tale (like the backwards storytelling of the Stephen Sondheim musical “Merrily We Roll Along”) allows the piece to end on a moment of fragile hope.

Brown’s poppy songs, deftly performed by the wife-and-wife combo of Anita Ruth and Joan Griffith, would feel at home on, say, Carole King’s “Tapestry” album, with the sort of details that make a show stick in your mind: We know the marriage proposal, for instance, comes not just in Central Park, but on the west side of the park.

Similarly detailed work emerges from the actors, under Elena Giannetti’s brisk direction. Westberg O’Keeffe’s “Climb Uphill,” an insecure-actor song that is similar to, but predates, the audition song that won Emma Stone an Oscar for “La La Land,” is highlighted by the performer’s decision to use a mock-showy, “American Idol”-style gesture on the lyric “belting as high as they can.” Her droll “A Summer in Ohio” is another highlight.

The edgy Levin and warm Westberg O’Keeffe are well matched in a show that has just two flaws: There aren’t many tickets left. And it’s performed on a set — a ramp to nowhere beneath an abstract gray backdrop — so hideous that I kinda wish I also could go back to the past, before I had to look at it.