In a nation that might be more divided than it has been since the Civil War, a true-life tale about bringing people together might just be the kind of film we need most right now.

“Green Book,” starring Viggo Mortensen and Mahershala Ali, takes audiences on a journey through the segregated South of the 1960s, featuring great performances, snappy dialogue, terrific music and a story that is as timely now as it was more than 50 years ago.

The film centers squarely on two lead performances: Mortensen as a New York City bouncer with a boisterous Italian-American family who calls himself Tony Lip, and Ali, a wealthy African-American pianist named Dr. Don Shirley who lives a refined but very lonely life in a swank apartment above Carnegie Hall. The year is 1962 and Dr. Shirley has become a superstar performer in the Northern states, but he remains determined to break through in the South with a tour that will take him into some of the most racist hotbeds in the nation.

Shirley knows that if a black man is pulled over while driving throughout the South the consequences could be dire: arrest, a beating, often death. Thus, he needs a tough white guy to be his driver and bodyguard on the eight-week run of shows, which feature Shirley and the two other white members of his jazz-classical combo playing for white elites. Those people treat Shirley great at the shows, but make it clear he’s looked down upon whenever he’s off the stage.

Tony has long been a scrappy bouncer at the Copacabana nightclub, but needs to find work to make it through the holiday season after a wild brawl he helped start shuts down the club for two months of renovations. Tony harbors the discreetly casual racism common in seemingly open-minded whites of the era, in one scene pointedly throwing away two glasses in his home after seeing that African-American workmen drank from them.

Forced to bond while on the road, Tony learns to loosen up and love Don, with a special appreciation for his stunning piano-playing abilities. Don, meanwhile, turns stereotypes on their ear by giving his own snobbery a break and finally trying Kentucky Fried Chicken. Don also learns about the looser wild stylings of piano-playing rockers Little Richard and Chubby Checker. On a deeper and more touching note, Don teaches Tony to have higher life standards for himself and helps him craft eloquent love letters to his wife that reinvigorate their marriage.

There are troubling moments throughout the journey, as the men contend with racism in various forms and Don turns out to have a deep-seated secret of his own. But this is a movie that is filled with a goodness of spirit and a richness of heart, showing pretty good people striving to do better and affirming the universal ability of great music to transcend all manner of cultural differences.

There is also a subtle appreciation of the great American landscapes (akin to those captured in “Kingpin,” “Dumb and Dumber” and “Me, Myself and Irene”) and the appreciation of Tony’s simple things that make this country so special, such as boyish eagerness to have Kentucky Fried Chicken in Kentucky. Mortensen and Ali deliver masterful performances that are almost certain to be Oscar contenders this year.

But the real surprise of “Green Book” is the man who directed it. Bobby Farrelly spent 20 years working with his brother Peter as the kings of raunchy comedies, presenting such gross-out comedy classics as “There’s Something About Mary,” “Dumb and Dumber” and “Kingpin.” But as audience tastes matured and veered away from their risqué fare, Farrelly realized he needed to reinvent his career or watch it slip away.

His reinvention here is splendid, revealing a gift for the full range of human emotion and the ability to squeeze frequent laughs out of high drama. “Green Book” might seem like a race-flipped “Driving Miss Daisy” crossed with an interracial “Planes, Trains & Automobiles,” but those are two timeless classics and very good company indeed.