Gore Vidal was impossible to categorize, which was exactly the way he liked it.

The reading public knew him as a literary juggernaut who wrote 25 novels —from the historical “Lincoln” to the satirical “Myra Breckinridge” — and volumes of essays critics consider among the most elegant in the English language. He also brought shrewd intelligence to writing Broadway hits, Hollywood screenplays, television dramas and a trio of mysteries still in print after 50 years.

When he wasn’t writing, he was popping up in movies, playing himself in “Fellini’s Roma,” a sinister plotter in sci-fi thriller “Gattaca” and a U.S. senator in “Bob Roberts.” The grandson of a U.S. senator, he also made two entertaining but unsuccessful forays into politics, running for the Senate from California and the House of Representatives from New York.

PHOTOS: Gore Vidal | 1925 - 2012

In other spare moments, he demolished intellectual rivals like Norman Mailer andWilliam F. BuckleyJr. with acidic one-liners, establishing himself as a peerless master of talk-show punditry.

“Style,” Vidal once said, “is knowing who you are, what you want to say, and not giving a damn.” By that definition, he was an emperor of style, sophisticated and cantankerous in his prophesies of America’s fate and refusal to let others define him.

Iconoclastic author, savvy analyst and glorious gadfly on the national conscience, Vidal died Tuesday at his home in the Hollywood Hills from complications of pneumonia, his nephew Burr Steers said. He was 86.

PHOTOS: 2012 notable deaths

In 1993, Vidal won the National Book Award for his massive “United States Essays, 1952-1992,” a collection of erudite and infuriating critiques on politics, sexuality, religion and literature written originally for such publications as The Nation, Esquire and the New York Review of Books.

“No one else in what he calls ‘the land of the tin ear’ can combine better sentences into more elegantly sustained demolition derbies than Vidal does in some of his best essays,” Thomas Mallon once wrote in the National Review.

Threaded throughout his pieces are anecdotes about his famous friends and foes, who included Anais Nin, Tennessee Williams, Christopher Isherwood, Orson Welles, Truman Capote, Frank Sinatra, Jack Kerouac, Marlon Brando, Paul Newman, Joanne Woodward, Eleanor Roosevelt and a variety of Kennedys. He counted Jacqueline Kennedy Onassis and Al Gore among his relatives.

Vidal began his public life at age 22 when his first novel, the World War II-themed “Williwaw,” won the wide admiration of critics. Two years later, however, the literary golden boy became an outcast with “The City and the Pillar” (1948), one of the first mainstream novels to deal frankly with homosexuality.

Ignored by book critics for the next several years, he turned to television writing, churning out dramas for prestigious showcases such as “Suspense,” “Goodyear Playhouse” and “Studio One.” He adapted one of these works, “Visit to a Small Planet” (1957), for the stage. A Cold War parable featuring a space alien who provokes war between the U.S. and the Soviet Union, it ran on Broadway for 388 performances and was made into a movie starring Jerry Lewis.

Vidal’s other major critical and commercial success as a playwright was “The Best Man,"a 1960 political drama that starred Melvyn Douglas as a high-minded presidential candidate modeled on Adlai Stevenson. After a 520-show Broadway run, it was made into a 1964 movie starring Henry Fonda. This spring it was revived on Broadway with a star-studded cast led by James Earl Jones and Angela Lansbury.

Although Vidal often declared the novel dead, he wrote more than two dozen of them. He called books such as “Burr” (1973), “Lincoln” (1984) and “Julian” (1964) “meditations on history and politics.”

Exploring the complexities of power and those who seek it, they were written, Vidal said, “to correct bad history,” but some critics said he was the guilty one.

“Inventions” was his term for his wilder fiction, which includes the comic novel “Duluth” (1983) and the wicked spoof featuring transsexual Myra Breckinridge in the novel by the same name. Some critics consider “Myra Breckinridge” (1968) his masterpiece.

Vidal was an insider by dint of his connections in Washington, Hollywood and literary salons around the world. But he acted more as the outsider.

He wrote a lengthy defense of Oklahoma City bomber Timothy McVeigh in a 2001 article for Vanity Fair that described their unusual bond. McVeigh had struck up a correspondence from prison after reading a piece by Vidal on the erosion of the U.S. Bill of Rights in the federal attack on the Branch Davidian compound near Waco, Texas. The two men remained pen pals for three years, until McVeigh’s execution.

A fierce critic of the U.S. as a “national security state,” Vidal seemed to move further into the political wilderness after the 9/11attacks in New York and on the Pentagon, suggesting that the George W. Bush administration had colluded with the terrorists. His views turned many longtime admirers into detractors, including writer Christopher Hitchens, who denounced Vidal as a crackpot.

“Gore was an iconoclast. That was his strength,” former Nation editor Victor Navasky told The Times several years ago. While some critics believed Vidal should be remembered for his essays, others, like Navasky, thought it would be for the bridges he burned.

Vidal crafted many of his diatribes at his villa in Ravello, Italy, where he lived for three decades. In 2005, he returned full time to his other longtime home, a mansion in the Hollywood Hills.

He had a lifelong fascination with Hollywood as a place of invention and reinvention, the chief motifs of his unusual life.

Vidal grew up expecting a career in national politics. “I never wanted to be a writer. I mean, that’s the last thing I wanted,” he once told critic Charles Ruas.

He was born Eugene Luther Gore Vidal on Oct. 3, 1925, in West Point, N.Y. His father, Eugene, was an aviation expert who taught at theU.S. Military Academy and later served as director of air commerce under PresidentFranklin D. Roosevelt. His mother, the former Nina Gore, was a Washington socialite whom he portrayed as a heavy drinker with a nasty temper. The Gores divorced when Vidal was 10 and his mother was briefly married to Hugh Auchincloss, who later married Jacqueline Kennedy’s mother.

A complete list of survivors was not available, but his nephew said they include a half-sister, Nina Straight, and a half-brother, Thomas Auchincloss.

Because of his poor relationship with his mother, Vidal spent much of his childhood living in Washington with his maternal grandfather, Sen. Thomas P. Gore, an influential Oklahoma Democrat. Vidal spent many hours reading to the blind senator, particularly from the U.S. Constitution and the Bill of Rights, two documents that would become touchstones in his political writing.

Vidal graduated from Phillips Exeter Academy in 1943, skipped college and joined theU.S. Army. He trained at the Virginia Military Institute and served on a freight-supply ship in the Aleutian Islands, where he became familiar with the sudden blasts of wind called williwaws. During night watches in port he began to write “Williwaw,” which earned flattering reviews and established its young author as a leading member of the post-World War II class of first-time novelists that included Mailer and Capote.

But neither “Williwaw” nor his next novel, “In a Yellow Wood” (1947), gained as much notice as his third effort, “The City and the Pillar” (1948), which centered on two athletic, boy-next-door-types who become lovers. Semi-autobiographical, it was inspired by Vidal’s love for a schoolmate, Jimmie Trimble, who died while serving in the Marines at Iwo Jima. Vidal said he did not realize until decades later that Trimble had been “a completion of myself,” the one genuine love of his life.

Though commercially successful, the book closed the door on Vidal’s political ambitions and made him a literary persona non grata. But it has remained in print and still studied by scholars because Vidal “wrote what had never been published by a reputable American writer: an unreserved novel about the homosexual demimonde and the ‘naturalness’ of homosexual relations,” critic Robert Kiernan wrote.

To survive financially after critics blacklisted him, Vidal produced several books under fictitious names, the most successful of which were the three mysteries he wrote as Edgar Box. Critics praised “Death in the Fifth Position” (1952), “Death Before Bedtime” (1953) and “Death Likes It Hot” (1954), which were reissued in 2011.

Vidal also turned his talents to screenplays, which included his successful adaptation of Tennessee Williams’ “Suddenly, Last Summer.” He was an uncredited writer on the 1959 blockbuster “Ben Hur,” contributing what he described as a homoerotic subtext to the relationship between the two male leads, Charlton Heston and Stephen Boyd. (His last major screenwriting credit was for the X-rated “Caligula,” a disastrous 1979 film produced and co-directed by Penthouse publisher Bob Guccione.)

In 1960, the same year that “The Best Man” opened on Broadway, Vidal made his political debut, running for a House seat as a liberal Democrat in a conservative upstate New York district. Noting in the New York Times that his objective was to “subvert a society that bores and appalls me,” he championed issues such as recognition of Red China and reducing the military budget. Not surprisingly, he lost.

Two decades later in California he trailed Jerry Brown by a large margin in a bid for the 1982 Democratic nomination for a U.S. Senate seat.

Vidal was far more successful writing about political power than acquiring it.

His first historical novel was “Julian” (1964), a bestseller about the 4th-century Roman emperor who rejected Christianity. Praised as a vivid evocation of the era, it freed Vidal from literary Siberia. He went on to re-imagine American history in “Washington, D.C.,” “Burr,” “1876,” “Lincoln,” “Empire,” “Hollywood” and “The Golden Age.”

Among the most controversial was “Lincoln,” which portrayed the 16th president as a devious, possibly syphilitic leader who cared more about preserving the Union than ridding it of slavery. Lincoln biographer Richard N. Current, writing in the Journal of Southern History in 1986, said the novel “grossly” distorted Lincoln’s character and was “wrong on big as well as little matters.”

Championing Vidal was a titan of literary criticism, Harold Bloom. Writing in the New York Review of Books, he called Vidal “a masterly American historical novelist, now wholly matured, who has found his truest subject, which is our national political history.”

Vidal spoke in a radically different voice in “Myra Breckinridge” (1968), a graphic satire about a sociopathic transsexual who goes to California to become a Hollywood star. Called “repulsive” and “brutally witty” by the New York Times, it became a massive bestseller. The 1970 movie, which critics panned, starred Raquel Welch as Myra.

In a similarly savage vein were “Myron,” a sequel to “Myra Breckinridge”; “Duluth” (1983), which spoofs America in the Reagan era; and “Live from Golgotha: The Gospel According to Gore Vidal” (1992), which was denounced by the Vatican for its scathing view of Jesus and his followers. “If God exists and Jesus is His son,” novelist John Rechy wrote in a Los Angeles Times review, “then Gore Vidal is going to hell.”

Vidal never wrote the Great American Novel. But he wrote scores of classic essays, beginning with “The Twelve Caesars,” which was written in 1952 but not published until 1959 because of its provocative assertions about sex and power.

“I am at heart a propagandist, a tremendous hater, a tiresome nag, complacently positive that there is no human problem which could not be solved if people would simply do as I advise,” he said in “Gore Vidal: A Biography” (1999) by Fred Kaplan.

Despite his crushing forthrightness on many topics, Vidal preferred ambiguity in the personal realm.

Vidal, who was never married and had no children, wrote in his memoirs about sexual contacts with men, including Kerouac, the Beat poet and writer. But, to the dismay of gay activists, Vidal rejected efforts to put him in any sexual category. He was famous for proclaiming that “there are not homosexual people, only homosexual acts.”

His companion of 53 years was Howard Auster, whom he met in New York in the 1950s when Auster was a singer trying to get a job in advertising. Vidal described their relationship as platonic and said “no sex” was the reason for its longevity.

He wrote movingly of Auster’s 2003 death from cancer in “Point to Point Navigation” (2006), the sequel to his first memoir, “Palimpsest” (1995). Auster was buried in Rock Creek Cemetery in Washington, “as I shall be in due course,” Vidal wrote, “when I take time off from my busy schedule.”

elaine.woo@latimes.com

Former Times staff writer Mary Rourke contributed to this report.