The basic virtue of “Hidden Figures” (which opens on December 25th), and it’s a formidable one, is to proclaim with a clarion vibrancy that, were it not for the devoted, unique, and indispensable efforts of three black women scientists, the United States might not have successfully sent people into space or to the moon and back. The movie is set mainly in 1961 and 1962, in Virginia, where a key NASA research center was (and is) based, and the movie is aptly and thoroughly derisive toward the discriminatory laws and practices that prevailed at the time.

The insults and indignities that black residents of Virginia, and black employees of NASA, unremittingly endured are integral to the drama. Those segregationist rules and norms—and the personal attitudes and actions that sustained them—are unfolded with a clear, forceful, analytical, and unstinting specificity. The efforts of black Virginians to cope with relentless ambient racism and, where possible, to point it out, resist it, overcome it, and even defeat it are the focus of the drama. “Hidden Figures” is a film of calm and bright rage at the way things were—an exemplary reproach to the very notion of political nostalgia. It depicts repugnant attitudes and practices of white supremacy that poisoned earlier generations’ achievements and that are inseparable from those achievements.

“Hidden Figures” is a subtle and powerful work of counter-history, or, rather, of a finally and long-deferred accurate history, that fills in the general outlines of these women’s roles in the space program. Its redress of the record begins in West Virginia in 1926, where the sixth-grade math prodigy Katherine Coleman is given a scholarship to a school that one of her teachers refers to as the only one in the region for black children that goes beyond the eighth grade. She quickly displays her genius there—but the school’s narrow horizons suggests the sharply limited opportunities for black people over all.

The nature of those limits is indicated in the very next scene, which cuts ahead to a lonely road in Virginia in 1961. There, a car is stalled, its hood open. Katherine is there with her two other African-American friends and colleagues. She’s sitting pensively in the passenger seat; Dorothy Vaughan (Octavia Spencer) is beneath the engine, trying to fix it; and Mary Jackson (Janelle Monáe) is standing impatiently beside the car. A police cruiser approaches. They tense up; Dorothy says, “No crime in a broken-down car,” and Mary responds, “No crime being Negro, neither.” Their fearful interaction with the officer—a white man, of course, with a billy club in hand and a condescending bearing—is resolved with a comedic moment brought about by the women’s deferential irony. What emerges, however, is nothing less than an instance in a reign of terror.

Dorothy is the manager and de-facto supervisor of a group of “computers”—about thirty black women, all skilled mathematicians—that includes Katherine and Mary. Dorothy is awaiting a formal promotion to supervisor, but a talk with a senior administrator makes clear that it’s not to be; the clear but unspoken reason is her race. (Tellingly, Dorothy addresses that official, played by Kirsten Dunst, as “Mrs. Mitchell,” who, in turn, calls her by her first name.) Mary, endowed with engineering skill, is summoned to a team led by an engineer named Zielinski (Olek Krupa), a Polish-Jewish émigré who escaped the Holocaust and who encourages her to seek formal certification as an engineer. To do so, Mary will have to take additional classes—but the only school that offers them is a segregated one, whites-only, from which she’s barred.

When NASA astronauts ceremoniously arrive at the research center, the black women “computers” are forced to stand together as a separate group, conspicuously divided from the other scientists. (Only John Glenn, played by Glen Powell, greets them, and does so warmly, shaking their hands and lingering to chat with them about their work.)

As for Katherine—now Katherine Goble, the widowed mother of three young girls—she’s plucked from the pool of mathematicians to join the main research group, headed by Al Harrison (Kevin Costner). There, she’s the only black person and the only woman (other than the secretary, played by Kimberly Quinn). She once again rapidly displays her mathematical genius, but not before being taken for the department custodian; forced to drink from a coffeepot labelled “colored”; treated dismissively by the lead researcher, Paul Stafford (Jim Parsons); and compelled to walk a half-mile to her former office in order to use the “colored ladies’ room.” (Moreover, the contrast between that depleted and dilapidated facility and the well-appointed and welcoming white-women’s bathroom proves the meaning of “separate but unequal.”)

Each of the three women has a particular conflict to confront, a particular focus in the struggle for equality. Mary’s struggle takes place in a public forum: she petitions a Virginia state court for permission to take the needed night classes in a segregated school. She’s not represented by a lawyer, and speaks on her own behalf; but, rather than making her case in open court, she makes a personal plea to the judge that’s as much about him and his outlook as it is about her, and her work and its usefulness. What her plea isn’t about is law, rights, or justice.

The omission is no accident; it’s set up by dramatic contrast with the angry insistence of Mary’s husband, Levi (Aldis Hodge), a civil-rights activist, that she not bother pursuing a job as an engineer: “You can’t apply for freedom. . . . It’s got to be demanded, taken.” Mary says that there’s “more than one way” to get opportunities, but the deck of this debate is stacked by the terms in which Levi couches it, saying that there’s no such thing as a woman engineer—at least, not a black one—and blaming her for not being home often enough to take proper care of their children.

Dorothy’s pursuit of a formal promotion to supervisor also takes place against the backdrop of the civil-rights movement. She learns that her entire department of human “computers” will soon be replaced by an electronic computer—an enormous I.B.M. mainframe that’s being installed. A gifted technician, Dorothy seeks out a book from the local library (a segregated library from which she’s thrown out), in which she’ll learn the programming language Fortran; she soon becomes NASA’s resident expert. On that trip to the library, in the company of her two sons on the cusp of adolescence, they witness a protest by civil-rights activists chanting “segregation must go” and see police officers, with police dogs, approaching the protesters. Dorothy and her sons pause and look, until she tells them to “pay attention that we’re not part of that trouble.” But, sitting in the back of the bus with them, she emphasizes that “separate and equal aren’t the same thing,” and adds, “If you act right, you are right.”

Katherine, too, fights for her dignity and for opportunities at work. Her calculations very soon prove indispensable to the effort to put the first American astronaut, Alan Shepard, into outer space. (The scene in which she displays her calculations to the entire office of scientists features a small but brilliant stroke of film editing, which suggests that she envisioned the effect of that bold step before she took it.) She’s fighting prejudice against blacks, against women (none has ever been admitted to a Pentagon briefing, where she can get the information she needs for her analyses), and against bureaucracy itself. Paul, who has been the department’s resident genius, and to whom she reports, is resentful of his subordinate—a black woman, for good measure—outshining him in mathematical talent and analytical insight.