Teacher Fredi Cameron (George Lopez), left, guides a group of immigrant students to a robotics competition in “Spare Parts.” (Ursula Coyote/Pantelion Films/Lionsgate)

The feel-good story “Spare Parts” — an inspirational underdog drama about four undocumented immigrant kids from a Phoenix high school who go toe-to-toe against a team of MIT whiz kids in an underwater robotics contest — is just about as cornball and sappy as it sounds. It’s also pretty darn thrilling.

And — oh, by the way — it’s also pretty much true.

Loosely inspired by the 2005 Wired magazine article “La Vida Robot,” “Spare Parts” stars comedian George Lopez as the science teacher who coaches and mentors the misfit robotics club profiled in the article. Lopez, whose character is a fictionalized amalgam of the two teachers who actually oversaw the unexpected performance of a robot jerry-rigged from plumbing supplies and pool noodles, is one of the biggest names in the film. Jamie Lee Curtis, as the goofball school principal, provides comic relief, with Marisa Tomei bringing a touch of class as Lopez’s love interest.

But it is the four young actors who play the students who truly shine, and who elevate the formulaic film above and beyond its familiar proceedings. Carlos PenaVega plays the team’s square-jawed straight arrow and motivational leader, Oscar. David Del Rio plays sweetly shy math nerd Cristian. José Julián is the law-bending grease-monkey Lorenzo. And Oscar Gutierrez is gentle giant Luis, the club’s muscle.

But despite sounding like pages out of the catalogue of casting cliches, these four parts are written in such a way (by Elissa Matsueda, adapting Joshua Davis’s article) that they feel as real as their inspirations. (A documentary on the same subject, “Underwater Dreams,” is available on Amazon Instant.) It also helps that the acting ensemble brings enormous sensitivity and appeal to the roles, ultimately overriding any reservations you may have about the cheese content of the film.

Lopez, for his part, also is surprisingly good, in a role that calls for his character to do more than teach about servo motors. Taking his name from real-life teachers Fredi Lajvardi and Allan Cameron, Lopez’s Fredi Cameron offers more to his four teenage charges than guidance — including, in Lorenzo’s and Cristian’s case, surrogate fathering. Lopez sidesteps both clownishness and bathos, bringing an appropriate straightforwardness to a part that is essentially a supporting role. Like the character of Fredi, who cannot provide outside help in the boys’ robot-building effort, the actor sublimates his own ego in the service of the larger story, which is about the four boys, not their supervisor.

The theme of immigration reform plays a part in the film as well. The threat of deportation looms large over the heads of these adolescents, especially Oscar, who dreams of serving in the U.S. military.

Without giving too much away — and for reasons that have nothing to do with whether they win or lose the competition — the characters in “Spare Parts” all go through changes that are true to many immigrants’ decidedly mixed experiences in the American melting pot.

PG-13 At area theaters. Contains some coarse language and a fistfight. 113 minutes.