It isn’t easy to generate genuine suspense from a historical dramatization when everybody in the audience is aware of how things will turn out, but in his third feature “Argo,” Ben Affleck manages the trick. The tale of six diplomats who escaped the Iranian takeover of the American embassy in Tehran in 1979 and hid with the Canadian ambassador and his wife until they could be gotten out of the country is well known. But it was only in 1997 that the details of the extrication were declassified, and though they were the subject of a couple of articles (a book has recently hit the shelves), they haven’t been widely publicized. That leaves the story with an element of surprise.

But in the spirit of truth being stranger than fiction, the reality also possesses a strongly comic element to go along with the espionage aspect—the fact that the cover story that made the ultimate escape from Iran possible involved an elaborate charade about scouting locations for a phony Hollywood sci-fi extravaganza. By juxtaposing an actual tale of international intrigue against a setting that’s famous for its own brand of deception and manipulation, the picture gets the best of both worlds, and Affleck takes full advantage of the possibilities for both tense drama and satiric humor. The result is a picture that can raise goosebumps while also eliciting laughs.

Affleck himself plays Tony Mendez, the CIA expert who comes up with the apparently daft scheme to rescue the six and sells it to his immediate boss Jack O’Donnell (Bryan Cranston) and higher-ups in the Carter administration. But he has to arrange the backstory in California, using an old ally, makeup man John Chambers (John Goodman), who in turns enlists over-the-hill producer Lester Siegel (Alan Arkin). In a scenario that recalls David Mamet’s “Wag the Dog” (though with a very different purpose), these two salty, hilariously irreverent old pros generate maximum publicity for their spurious “Star Wars” ripoff, the titular “Argo,” which gives Mendez the cover he needs to fly into Tehran, secure the required official permissions, and prep the diplomats to impersonate a movie crew well enough to make it past the Revolutionary Guards manning security posts at the airport. His sometimes-uneasy interaction with the Americans (who include Tate Donovan as the senior diplomat and Scoot McNairy as the most doubtful of the group but one whose knowledge of Farsi comes in handy at a critical moment) and the Canadian ambassador (Victor Garber) takes up much of the picture’s second half, though there are amusing cutaways back to Washington and California, where Cranston, Goodman and Arkin leaven the fingernail-biting Iranian sequences with a periodic dose of humor while contributing to the buildup to the big finale.

Does “Argo” stick resolutely to the actual record? Of course not. This is a Hollywood movie, not a History Channel documentary, and there are plenty of alterations, not least in the last act, which is juiced up with a last-second Iranian attempt to halt the escape at the airport that’s more invention than recreation. But on the visceral level it certainly works, which is what’s important here. The film is an exciting, fact-based action thriller that adds some real human dimension and satirical jabs to the mix (though it probably could have done without the insistently heart-tugging inserts concerning Mendez’s separation from his wife and his yearning to be with his young son).

The film has been expertly mounted, with Rodrigo Prieto’s cinematography carefully gauged to accommodate the juxtaposition of the recreation of the embassy takeover, staged in Istanbul, with archival footage of the event, and production designer Sharon Seymour, art director Peter Borck, set decorator Jan Pascale and costume designer Jacqueline West all contributing to a convincing, unexaggerated period feel. Alexandre Desplat’s score boosts the energy of the action scenes while avoiding bombast.

As to the acting, Affleck anchors the piece with a solid, restrained piece of work as Mendez. He certainly doesn’t hog the screen, giving Goodman, Arkin and Cranston ample opportunity to steal scenes outright, which they all do with practiced glee. Garber cuts a figure of quiet authority as Ken Taylor, the Canadian ambassador, and Bob Gunton and Kyle Chandler are effective impersonating Secretary of State Cyrus Vance and Carter’s Chief of Staff Hamilton Jordan, respectively. Among the near-hostages, Donovan and McNairy stand out, but Clea DuVall, Christopher Denham, Rory Coltrane and Kerry Bishe all contribute incisive performances.

This is Affleck’s third movie, following “Gone Baby Gone” and “The Town,” and he’s batting a thousand. That’s a record the most seasoned director would envy.