Mr. Mendez, a 25-year veteran of the spy agency, was effectively in the business of geopolitical theater. Pulling techniques from magicians, movie makeup artists and even the television show “Mission: Impossible,” he changed one person into another, transforming agents into characters with backstories, costumes and documents that helped them evade detection and avoid capture in foreign countries.

Appropriately for a man whose career seemed drawn from a Hollywood thriller, his greatest triumph hinged on a bogus sci-fi film, a sham production office in Los Angeles and a fake location-scouting expedition to Iran. Disguising himself as an Irish filmmaker, Mr. Mendez successfully smuggled six State Department employees out of Tehran during the 1979-1981 Iran hostage crisis, passing them off as a Canadian movie crew in a daring mission that formed the basis of the Oscar-winning movie “Argo” (2012).

AD

AD

Mr. Mendez, who was portrayed by actor-director Ben Affleck in the film, was 78 when he died on Jan. 19 at an assisted-

living center in Frederick, Md. He had Parkinson’s disease, said his wife, fellow CIA veteran Jonna Mendez.

A painter of impressionistic landscapes and outdoor scenes, Mr. Mendez was working as a draftsman when he was recruited by the CIA in 1965, and he ran an art studio after he retired. “I’ve always considered myself to be an artist first,” he once said, looking back on his career, “and for 25 years I was a pretty good spy.”

After stints in Laos, India and the Soviet Union, he was serving as the CIA’s chief of disguise when the U.S. Embassy in Tehran was seized by a militant Iranian student group on Nov. 4, 1979. The attack came months after the Islamic revolution forced out the country’s leader, the Western-backed shah, and replaced him with the hard-line cleric Ayatollah Ruhollah Khomeini.

Sixty-six Americans, including six CIA officers, were taken hostage, while six other U.S. diplomats managed to evade capture and took shelter in the homes of two Canadians, ambassador Ken Taylor and embassy official John Sheardown.

AD

AD

In the 444 days that followed, the hostage crisis drew unflagging news coverage, crippled Jimmy Carter’s presidency and resulted in the deaths of eight service members during a failed rescue mission in the Iranian desert. Mr. Mendez completed his rescue operation Jan. 28, 1980, but it took one more year before the last 52 hostages were released, on the day of Ronald Reagan’s inauguration in ­January 1981.

The Canadian caper

The idea for the “Canadian caper,” as Mr. Mendez’s mission came to be known, was born out of desperation. A specialist in “exfiltration,” the art of whisking people out of harm’s way, Mr. Mendez initially worked on a plan to free the American hostages by exchanging them for a dead body double of the shah, who was being treated for cancer in the United States.

AD

That plan was nixed by the White House, according to a Wired magazine account by Joshuah Bearman, and when Mr. Mendez was promoted to chief of the agency’s authentication branch in December 1979, his efforts shifted to rescuing the six Canadian “houseguests,” as the American diplomats were euphemistically called. Their very existence was kept hidden from the public in an effort to protect them from the Iranians.

AD

Although one Canadian minister suggested that the diplomats head for the Turkish border, possibly on bicycles, only a departure through the air seemed viable. Mr. Mendez just needed to settle on a story that would enable the escapees to board a plane. Schemes that centered on teachers, crop inspectors and oil technicians all seemed flawed. So Mr. Mendez decided to “reverse the rules and create a distraction.”

“A cover should be bland, as uninteresting as possible, so the casual observer, or the not-so-casual immigration official, doesn’t probe too deeply,” he wrote in a 1999 memoir, “The Master of Disguise.” His solution, the film gambit, was the opposite of bland — an idea so bold, he believed, that Iran would never consider that it might be fake.

AD

Mr. Mendez called his friend John Chambers, a makeup artist who had won an honorary Oscar for his work on “Planet of the Apes,” gave Spock his pointy ears and had assisted the CIA on old assignments. With another makeup artist, Bob Sidell, who later worked on “E.T.,” they opened a production office in Los Angeles; created business cards for their fictional company, Studio Six Productions; and developed backstories and career histories for the six escapees.

AD

Mr. Mendez and Chambers named their purported science-fiction film project “Argo,” for the raunchy punchline to a knock-knock joke and in a sly nod to the mythological ship that Jason used to retrieve the Golden Fleece. Advertisements in Variety and the Hollywood Reporter promoted the film as a “cosmic conflagration.”

With a Canadian passport in hand, Mr. Mendez flew to Tehran on Jan. 25, under the name Kevin Costa Harkins. (He chose an Irish identity, he later said, because the Irish are “nonthreatening” and “ubiquitous around the world.”) Supported by a second CIA agent known as Julio, he spent a few days coaching the six diplomats, teaching them their new identities — including as a cameraman and set designer — and preparing them for potential interrogations at the airport.

AD

Before dawn on Jan. 28, they headed to Tehran Mehrabad International Airport for an early Swissair flight to Zurich. After being delayed for an hour because of a mechanical problem, the flight took off and cleared Iranian airspace, leading Mr. Mendez to celebrate by ordering a bloody mary and delivering a toast: “We’re home free.”

AD

The diplomats returned to a heroes’ welcome in the United States, where Canadian flags were flown from town halls, and billboards reading “Thank you, Canada” cropped up around the country. Mr. Mendez met with Carter in the Oval Office and received the Intelligence Star, one of the CIA’s highest honors. But his and the CIA’s role in the rescue operation was concealed until 1997, when Mr. Mendez was honored as one of 50 “trailblazers” who shaped the agency’s first 50 years.

'Like being a time traveler'

Antonio Joseph Mendez was born in Eureka, Nev., on Nov. 15, 1940, to a mixed-heritage family (Italian, Mexican, Welsh) that he later credited with helping him blend in around the world. He was 3 when his father died in a copper-mining accident; his mother worked several jobs.

AD

The family had little money, and Tony contributed by digging up bat guano in caves, loading it onto a toy wagon and selling it to his Mormon neighbors as fertilizer, $1 per gunny sack. He sometimes dated his covert operations experience to an incident in which he posed as a girl to gain entrance to a couples-only school dance.

AD

Mr. Mendez graduated from high school in Denver and, unable to cover tuition, quit the University of Colorado after one year. He was an illustrator at Martin Marietta, drawing parts for an intercontinental ballistic missile, when he saw a help-wanted ad in a newspaper: “Artists to Work Overseas — U.S. Navy Civilians.” Consumed by wanderlust, he went to interview and was handed a CIA recruitment guide.

Mr. Mendez retired in 1990 with a rank equivalent to that of a two-star general. He wrote several memoirs, including “The Master of Disguise,” co-authored with Malcolm McConnell. The book, along with Bearman’s article in Wired, served as the source material for “Argo,” which won the Oscar for best picture. (The filmmakers took some liberties with the facts, Mr. Mendez said, including adding a chase scene and writing out two of his children.)

AD

Mr. Mendez’s first wife, Karen, died of lung cancer in 1986. In 1991 he married Jonna Hiestand, an expert on clandestine photography who also served as the CIA’s chief of disguise. In addition to his wife, of Reston, Va., who confirmed his death, survivors include two children from his first marriage, Amanda Mendez of Smithsburg, Md., and sculptor Toby Mendez of Knoxville, Md.; a son from his second marriage, Jesse Mendez of Charleston, W.Va.; several sisters; and two grandchildren. He was predeceased by a son from his first marriage, Ian Mendez.

AD

Makeup, Mr. Mendez often said, was typically one of the easier parts of developing a disguise. Behavioral tics needed to be adjusted, credible backstories invented.

“There are occasions when you’re getting ready to put your name on the hotel ledger,” he told The Washington Post in 2000. “You’ve got reservations made for you in [an] alias. You’ve just flown 10 hours. There’s that moment when you put the pen down and you think, ‘Oh, jeez, what’s my name?’ ”

AD

“Once you go into the netherworld like that, by yourself,” he added, “it’s like going into another dimension. It’s like being a time traveler. How do you get back?”