“Hidden Figures” takes us back to 1961, when racial segregation and workplace sexism were widely accepted facts of life and the word “computer” referred to a person, not a machine. Though a gigantic IBM mainframe does appear in the movie — big enough to fill a room and probably less powerful than the phone in your pocket — the most important computers are three African-American women who work at NASA headquarters in Hampton, Va. Assigned to data entry jobs and denied recognition or promotion, they would go on to play crucial roles in the American space program.

Based on Margot Lee Shetterly’s nonfiction book of the same title, the film, directed by Theodore Melfi (who wrote the script with Allison Schroeder), turns the entwined careers of Katherine Goble (later Johnson), Mary Jackson and Dorothy Vaughan into a rousing celebration of merit rewarded and perseverance repaid. Like many movies about the overcoming of racism, it offers belated acknowledgment of bravery and talent and an overdue reckoning with the sins of the past. And like most movies about real-world breakthroughs, “Hidden Figures” is content to stay within established conventions. The story may be new to most viewers, but the manner in which it’s told will be familiar to all but the youngest.

This is not necessarily a bad thing. There is something to be said for a well-told tale with a clear moral and a satisfying emotional payoff. Mr. Melfi, whose previous film was the heart-tugging, borderline-treacly Bill Murray vehicle “St. Vincent,” knows how to push our emotional buttons without too heavy a hand. He trusts his own skill, the intrinsic interest of the material and — above all — the talent and dedication of the cast. From one scene to the next, you may know more or less what is coming, but it is never less than delightful to watch these actors at work.

Start with the three principals, whose struggles at NASA take place as the agency is scrambling to send an astronaut into orbit. Katherine Goble is the central hidden figure, a mathematical prodigy played with perfect nerd charisma by Taraji P. Henson. Katherine is plucked from the computing room and assigned to a team that will calculate the launch coordinates and trajectory for an Atlas rocket. She receives a cold welcome — particularly from an engineer named Paul Stafford (Jim Parsons) — and is not spared the indignities facing a black woman in a racially segregated, gender-stratified workplace. The only bathroom she is allowed to use is in a distant building, and she horrifies her new co-workers when she helps herself to a cup of coffee.

Dorothy (Octavia Spencer) and Mary (Janelle Monáe) also face discrimination. Dorothy, who is in charge of several dozen computers, is repeatedly denied promotion to supervisor and treated with condescension by her immediate boss (Kirsten Dunst). The Polish-born engineer (Olek Krupa) with whom Mary works is more enlightened, but Mary runs into the brick wall of Virginia’s Jim Crow laws when she tries to take graduate-level physics courses.

“Hidden Figures” effectively conveys the poisonous normalcy of white supremacy, and the main characters’ determination to pursue their ambitions in spite of it and to live normal lives in its shadow. The racism they face does not depend on the viciousness or virtue of individual white people, and for the most part the white characters are not treated as heroes for deciding, at long last, to behave decently. Two of them, however, are singled out for commendation: John Glenn, portrayed by Glen Powell as a natural democrat with no time for racial hierarchies; and Al Harrison, the head of Katherine’s group, for whom the success of the mission is more important than color.

Kevin Costner, who plays Al, is an actor almost uniquely capable of upstaging through understatement. He is also one of the great gum-chewers in American cinema, a habit that, along with the flattop haircut and heavy-framed glasses, gives Al an aura of midcentury no-nonsense masculine competence. He desegregates the NASA bathrooms with a sledgehammer and stands up for Katherine in quieter but no less emphatic ways when her qualifications are challenged.

It’s a bit much, maybe, but Mr. Costner, as usual, does what he can to give the white men of America a good name. The movie, meanwhile, expands the schoolbook chronicle of the conquest of space beyond the usual heroes, restoring some of its idealism and grandeur in the process. It also embeds that history in daily life, departing from the televised spectacle of liftoffs and landings and the public drama of the civil rights movement to spend time with its heroines and their families at home and in church. The sweetest subplot involves the romance between Katherine, a widow with three daughters, and a handsome military officer played by Mahershala Ali.

“Hidden Figures” makes a fascinating and timely companion to “Loving,” Jeff Nichols’s film about the Virginia couple who challenged their state’s law against interracial marriage, which was struck down by the Supreme Court in 1967. The two movies take place in the same state in the same era, and focus on the quiet dramas that move history forward. They introduce you to real people you might wish you had known more about earlier. They can fill you with outrage at the persistence of injustice and gratitude toward those who had the grit to stand up against it.