“Central Intelligence” is Rock-solid funny.

The story about two guys who went to high school together connecting 20 years later always had potential to create laughs. The key was finding someone with enough comedy muscle to work with Kevin Hart.

That comes through Dwayne Johnson.

Hart and Johnson go together so perfectly it’s like they were comedy twins separated at birth. The fact they work so well together makes “Central Intelligence” smart and entertaining. It also demands a sequel.

Johnson plays Bob Stone, who 20 years ago was the humiliating target of bullies. The only person in high school who showed him any kindness was the high school’s most popular student, Calvin Joyner (Hart).

Although Joyner married the woman of his dreams (Danielle Nicolet), he does not have the life he expected. On the eve of their 20th class reunion, Stone shows up asking Joyner for help with an accounting matter.

Stone is different. He has grown into a man mountain of muscle. He’s still hanging on to some of the geeky ways that made him a target of bullies (“Sixteen Candles” is his favorite movie).

Joyner soon learns Stone is in the CIA, and depending on whom you want to believe he’s either tracking the man who killed his partner or he’s wanted for the murder of his partner. It’s up to Joyner to decide whether or not he’s going to trust his high school classmate.

What makes Johnson so great is his dry sense of humor. He also gives the movie the action punch it needed.

Hart is funny. The only concern in his movies is whether he is given so much free rein that his performance ends up as an endless series of rants.

Director Rawson Marshall Thurber (“Dodgeball: A True Underdog Story”) allows Hart to play scenes with high energy. But he never allows him to completely fall into annoying rant mode. The result: This is one of Hart’s the best acting jobs.

Thurber’s script, written with Ike Barinholtz and David Stassen, doesn’t depend on muscle-bound jokes and mixes in plenty of smart writing. At one point, Stone tells Joyner he looks “like a black Will Smith.” In the scene where it is suggested Joyner go to couple’s therapy, he explains that African Americans don’t go to therapy to talk: “We go to the barbershop to talk. Or we watch ‘Barbershop.’”

The dumbest moments in “Central Intelligence” are the opening and closing sequences. Johnson’s character needed to be established as a high school loser and a new man by the reunion. Both sequences play clunky and don’t move as smoothly as the rest of the film.

The main reason the movie works is the chemistry between Johnson and Hart. They are like Bud Abbott and Lou Costello on steroids. It’s obvious the two men have a bond, even when they are running from a hail of bullets.

Toss in some fun cameos and “Central Intelligence” has all the elements to make it the funniest film to hit theaters this summer. After mind-numbing efforts like “Popstar: Never Stop Never Stopping,” it’s a joy to be reminded there are some smart people making movies like “Central Intelligence.”

———

CENTRAL INTELLIGENCE

3.5 out of 4 stars

Cast: Dwayne Johnson, Kevin Hart, Amy Ryan, Danielle Nicolet, Aaron Paul, Ryan Hansen

Director: Rawson Marshall Thurber

114 minutes

Rating: PG-13 (crude humor, nudity, language)