The first five minutes of “Lincoln” are frankly awful. The President, meeting with Union soldiers in some unspecified staging area, is first greeted by two white boys in blue, callow, starstruck lads who, like giggling fans, take it upon themselves to recite the Gettysburg Address to him. Then one of two black soldiers nearby follows up their performance by brazenly haranguing Lincoln about the inequitable treatment that he and others of his hue continue to receive, despite the Emancipation Proclamation.

You can understand the function of the sequence, which is sort of a prologue to what follows. Screenwriter Tony Kushner wants to situate the audience, telling them in effect that we’re at the endgame of the war and the treatment of blacks, even in the North, continues to weigh heavily on the nation’s—and the President’s—conscience. Fifty years ago, that information would have been handled—in a big-budget historical epic like this—through introductory narration intoned by some heavyweight character actor, often with a British-sounding accent—Alexander Scourby, perhaps. Given the quality of what Kushner and Spielberg came up with as a replacement, one might well have preferred the old way.

But once that sequence is out of the way, “Lincoln” finds its footing. It doesn’t try to be a full-fledged biographical piece. Instead it concentrates on the President’s determined effort, in the waning days of the war, to push through his proposed thirteenth amendment to the constitution, abolishing slavery—something thought necessary despite the Proclamation, which was a wartime measure that could be rescinded once peace came. The measure had already passed the Senate but was blocked by Democrats in the House, where it needed a two-thirds majority to be sent to the states for ratification.

The best thing about the screenplay is that while it doesn’t stint on Lincoln’s humane, folksy spirit—indulging in his penchant for interrupting the most serious moments with long-winded tall tales and anecdotes—it concentrates on his political instincts, and particularly on his willingness to use questionable tactics that amount to buying votes with presidential patronage to secure the amendment’s passage. As a result, it avoids the temptation to portray him as some sort of plaster saint, instead of the astute, calculating man he was—even going so far as to delay receiving a Confederate peace delegation, effectively prolonging the combat until he can secure the amendment’s passage. That theme extends to other historical figures depicted here as well—like Thaddeus Stevens, the Radical Republican, who’s shown deliberately moderating his long-held views on racial equality during the House debate in order not to alienate those less restrained in their views than he was.

Of course, “Lincoln” is drama, not documentary, and liberties are taken with the record. Much is made of Kentucky Congressman George Yeaman’s abrupt decision to vote “aye” in the end, for example—an act that’s treated here as a near-miraculous, principled change of heart that provides a typically rousing Spielbergian crest to the emotional wave. In fact, Yeaman was soon after appointed U.S. ambassador to Denmark, and it’s difficult to imagine that plum hadn’t been dangled before his eyes before the vote. But the film isn’t intended as a history lesson, and if that’s what one wants, one can always turn to the pages of Doris Kearns Goodwin’s “Team of Rivals” or the numerous other scholarly works on the Civil War period for it. As an uplifting history-based tale of political machination employed for high purposes, it works beautifully.

That’s not simply because of Kushner’s compelling script and Spielberg’s controlled (some will say ponderous) direction, but as a result of the expert performances. Daniel Day-Lewis’ Lincoln doesn’t stun—with a couple of volatile exceptions, he’s too laid-back and easygoing for that—but it’s a terrific turn that captures the man’s grace and humility, as well as his paternal devotion to his younger son Tad (Gulliver McGrath), but also his steely resolve and the weight of grief he had to bear, as president, husband and father. His restraint is matched by that of David Strathairn as his closest cabinet confidante Secretary of State William Seward, and by Joseph Gordon-Levitt as his oldest son Robert, who wants to join the army though Lincoln opposes it.

But elsewhere the cast is giving freer rein. Sally Field brings a surprising degree of ferocity to Mary Todd Lincoln, and Tommy Lee Jones rips and roars like a ferocious but cunning old lion as Stevens. James Spader, John Hawkes and Tim Blake Nelson exude roguish charm as the three vote-getters Seward hires on Lincoln’s behalf, while Hal Holbrook adds his touch of authority to Francis Blair, the grand old Republican who forced the President to consider a Confederate peace offer before agreeing to back the amendment. The rest of the cast—except for that unfortunate quartet in the introductory scene—do engaging work, even when the picture takes on a pageant-like feel.

From the technical perspective “Lincoln” is as smooth and professional a piece of work as one expects of Spielberg, with the burnished cinematography of Janusz Kaminski giving each scene the tone of a period photograph, accentuating the careful efforts of production designer Rick Carter, art directors Curt Beach, David Crank and Leslie McDonald, set decorator Jim Erickson and costume designer Joanna Johnston. The overall effect—complemented by John Williams’ score, which uses period pieces to provide color, as well as the assured but stately directorial style—can come across as static, but it carries cumulative emotional impact, especially in a coda dealing with the assassination.

“Lincoln” has some problems—witness that opening scene. But it succeeds beyond what one had any right to hope in avoiding simple hagiography, capturing Lincoln’s human frailty as well as his wily political side.