This image released by Prime shows Michael Pena in a scene from “A Million Miles Away.”
                                 Prime via AP

This image released by Prime shows Michael Pena in a scene from “A Million Miles Away.”

Prime via AP

<p>This image released by Prime shows Rosa Salazar, left, and Michael Pena in a scene from “A Million Miles Away.”</p>
                                 <p>Prime via AP</p>

This image released by Prime shows Rosa Salazar, left, and Michael Pena in a scene from “A Million Miles Away.”

Prime via AP

<p>This image released by Prime shows Rosa Salazar, right, and Michael Pena in a scene from “A Million Miles Away.”</p>
                                 <p>Prime via AP</p>

This image released by Prime shows Rosa Salazar, right, and Michael Pena in a scene from “A Million Miles Away.”

Prime via AP

If ever there was an inspirational story about reaching for the stars, it’s “A Million Miles Away,” the real-life journey of a how a boy who grew up as a migrant farmworker became a NASA astronaut.

It starts in the corn fields of Michoacan, Mexico, as José Hernández looks up into the sky in wonder, and it ends two hours later with him 200 miles above the Earth in the International Space Station.

“Tell me something,” his cousin tells him. “Who better than a migrant? Somebody who knows what it’s like to dive into the unknown. Who better than that?”

Biopics with outsized heroes can lay it on thick, but “A Million Miles Away” manages to keep its hero’s feet firmly on earth before his space shot, largely thanks to star Michael Peña as Hernández and Rosa Salazar as his wife. They keep their characters’ humanity even as the soundtrack and visuals blast off. He may be an astronaut, but someone still needs to take out the trash.

Screenwriters Bettina Gilois, Hernán Jiménez and Alejandra Márquez Abella — who base their story on Hernández’s memoir — tell a linear story of a gifted young man who is helped along the way by a teacher, his parents and his extended family. He is rejected so many times from NASA that he keeps all their letters in a folder.

Everyone sacrifices for Hernández to eventually become a mission specialist: His parents stop moving from field to field and lose their home, his wife delays her dreams of opening a restaurant and Hernández himself misses the birth of a child and spends endless hours away preparing. As an engineer, he is mistaken for a janitor at his first day at Lawrence Livermore National Laboratory.

“A Million Miles Away” is wisely more about one man’s obsession and nicely touches on topics like racism, assimilation, deferred dreams, family guilt and dedication. “Tenacity is a superpower,” he is told and that’s a pretty great lesson amid all these superhero flicks.

In many ways, the movie is an outsized twin to another biopic this year — “Flamin’ Hot,” the story of how a struggling but tenacious Mexican American janitor came up with the hit snack Flamin’ Hot Cheetos. “A Million Miles Away” even has a scene with a bowl of Doritos.

Alejandra Márquez Abella directs with assurance and there are some truly elegant touches, like when a box of paperwork dissolves to become a box of field crops or when the camera captures Hernández as a boy in the family car and then seamlessly shows him all grown up in a car following.

But the director also threatens to lay it on thick, like adding the image of a Monarch butterfly floating in the space shuttle — a symbol from the film’s first frames but one that feels labored by the time zero-gravity has been reached. We’ve already had a shot of farmworkers gazing up in their field as his shuttle streaks heaven-ward.

Better are the scenes in which Hernández tries to make himself typical NASA material, like trading in his Impala for something more suburban, eating sandwiches at work — not enchiladas — and giving up blasting Mexican music for Rick Astley. “I think you’re trying to forget who you are,” he is told.

There is a scene later with no dialogue that soars because we’ve watched Hernández persist for so long: Seeing him drive through the NASA headquarters front gate with a Los Tigres del Norte song blaring from his truck and a smile on his lips.

Peña almost underplays his hero — a smart move and nicely done — but Salazar threatens to steal the film completely as a strong, loving, stressed-out mother and wife. “We grew up watching our people make sacrifices. It’s on us now,” she says.

Toward the end, he shows up at her restaurant in one of those coveted blue astronaut coveralls for the first time after being chosen to fly to space and is promptly sent to the kitchen. They are a dishwasher down, after all, and he needs to put in a shift, NASA or not. That perfectly captures this sweet, loving and worthwhile portrait of a family’s grit.