Stan Lee, a writer and editor often credited with helping American comics grow up by redefining the notion of a superhero, including the self-doubting Spider-Man, the bickering Fantastic Four, the swaggering Iron Man and the raging Incredible Hulk, died Nov. 12 at a hospital in Los Angeles. He was 95.

An attorney for Mr. Lee’s daughter confirmed the death in a statement. The cause was not immediately available.

Mr. Lee’s name became synonymous with the company that would become Marvel Comics, which he joined as a teenage assistant and stayed with for much of his adult life.

After toiling in comics for 20 years as a self-described hack, on the verge of quitting the business, he was ordered by his boss to emulate a line of superheroes done by rival DC Comics. Mr. Lee’s full-color, morally complex heroes helped foster a revival in a largely moribund profession.

Comics had entered a dark age after Senate hearings in the early 1950s that condemned the trade for contributing to juvenile delinquency. What followed was a “comics code” to monitor standards and ban content deemed immoral and unsuitable for children.

In the ’60s, Mr. Lee took a distinctly new approach to characters and setting, as well as to the very interaction with readers who had grown used to comics that were aimed solely at a younger audience and that featured flawless, square-jawed heroes who had uncomplicated morals.

Michael Chabon, the Pulitzer Prize-winning author of the comic-book-themed novel “The Amazing Adventures of Kavalier and Clay,” said in an interview that Mr. Lee’s best-known characters were “vain, pompous, conceited. . . . Everything that works in comic books today is indebted to him for that.”

“There’s no question that Stan and the innovations he came up with saved the comic book and the superhero,” Tom Brevoort, Marvel’s senior vice president of publishing, told The Washington Post in 2011. “By crafting characters with feet of clay and personal problems — and not writing down to an audience that was perceived to be primarily 8-year-olds — Stan opened the doorway for more sophisticated and interesting treatments of any subject matter in comics. He made comics interesting and rel­evant and fun again.”

Lee told The Post in 2012: “All of our characters were freaks in their own way. The greatest example was with X-Men — they were hated because they were different. The idea I had, the underlying theme, was that just because somebody is different doesn’t make them better. . . . That seems to be the worst thing in human nature.”

Tension with Jack Kirby

Much of Mr. Lee’s success was indebted to his Marvel partnership with artist and frequent co-creator Jack Kirby. Their first superheroes, appearing in 1961, were the Fantastic Four.

They were unlike the perfectly genial Superman, a DC Comics character. The Fantastic Four were constantly at odds with one another. Mister Fantastic was a boring scientist constantly interrupted by the rest of the group. One of the Fantastic Four, the Thing, looked like a monster and often acted like one, and he hated the powers that made him look that way.

Other heroes came with their own weaknesses, such as the ­Jekyll-and-Hyde-like Incredible Hulk, who could not control the anger that gave him his strength, and Daredevil, whose blindness helped develop other heightened senses. Iron Man was a billionaire industrialist modeled after Howard Hughes; his weakness was a piece of shrapnel dangerously close to his heart, acquired on a trip to Vietnam to inspect the weapons he produced for the war.

(Mr. Lee wrote in his 2002 memoir, “Excelsior!”: “Due to his injury, he always had to either wear the iron armor, or an iron chest plate he had fashioned for himself, to keep his heart beating. If that explanation doesn’t sound medically correct, hey, he’s a comicbook hero and I’m not a cardiologist.”)

With artist Steve Ditko, Mr. Lee created Spider-Man in 1962, of whom cartoonist and author Jules Feiffer said, “He took the anxiety and schlumpiness that had become part of the culture from the ’60s on and put them into the character of a superhero.”

Besides giving the characters human personalities, the artists further attracted readers with the comics’ realistic settings. While other heroes protected fictional cities such as Metropolis and Gotham, Mr. Lee’s lived in his native New York.

Mr. Lee constantly addressed and engaged the readers. In his memoir, written with George Mair, he remembered one particular author’s note: “On the cover I wrote something like, ‘Look, this may not be one of the best stories we’ve ever done, but we’ve given you enough good ones so that you owe it to us to buy this lemon anyway.’ ”

“Stan was the first writer to bring an ironic distance to the material,” said Marvel writer Gerry Conway, as quoted in Tom Spurgeon and Jordan Raphael’s “Stan Lee and the Rise and Fall of the American Comic Book” (2003).

Behind the scenes, Mr. Lee worked to foster a different kind of collaborative process with his artists.

Traditionally, comics were drawn from a screenplay-like script provided by the writer. Instead, Mr. Lee said, he would offer his artists plot ideas and brainstorm with them. The artists would then draw the story, and he would later fill in dialogue and text.

Artists in his “bullpen,” where the artists worked in proximity to each other and to him, were much more involved in the creative process. This became known as the Marvel Method.

He crisscrossed the country as a popular college speaker, visiting campus chapters of the official fan clubs he founded, the Merry Marvel Marching Society and later the Friends of Ol’ Marvel. Marvel became — and remains — one of the best-selling comic book companies in the country. In 2009, the Walt Disney Co. reached an agreement to acquire Marvel Entertainment in a deal worth about $4 billion.

Mr. Lee has been criticized for not doing enough to acknowledge Kirby and Ditko’s roles in creating Marvel’s most popular characters. Marvel publicity and press coverage frequently played up Mr. Lee’s role and minimized his collaborators.

They were minimized legally, as well. Historically, none of the creators had any ownership rights, not even Mr. Lee. Because there were no royalties, comic artists often struggled financially after they stopped working.

In the 1970s, Kirby attempted to get back some of his original artwork to help support his family and sued. Mr. Lee, who was Marvel’s public face, refrained from taking an active role in the case. An elderly Kirby eventually received some of the art, years later, after agreeing to relinquish all claim to copyright.

Kirby and Mr. Lee had a falling-out. Kirby died in 1994.

“I made whatever I made because I was the editor . . . and I was the publisher and one-time president and chairman of the company,” Mr. Lee told The Post in 2012. “I was the scriptwriter. I made no more money than Jack, and at times he made more than I did. . . . If it hadn’t been for those other guys — like [comic book artist] John Romita [Sr.] — who took over so many of the [comics], I don’t think these comics” would be as popular today.

“Jack was great, and I have taken pains to say over and over again what a great collaborator he was and how much he contributed,” Mr. Lee continued. “But even when he was alive, I was the guy doing the publicity. I was . . . the guy boosting Marvel on the front lines. Jack was the voice of Jack Kirby, and at times, he left to work at DC, and when it served his interests better, he came back to Marvel.”

Took pen name in his teens

Stanley Martin Lieber was born in New York City on Dec. 28, 1922, the eldest son of Romanian Jewish immigrants. His father was a dress cutter who was frequently out of work.

Mr. Lee came by his pen name as a teenager. He claimed he changed his name not because of anti-Semitism, like many comic book artists, but because he wanted to preserve his real name to write a real book.

After graduating from high school, Mr. Lee took a job with Timely publications, a company that published Marvel and was owned by his cousin-in-law Martin Goodman. He was hired by Timely editor Joe Simon, who with Kirby co-created Captain America.

During World War II, Mr. Lee served in the Army and spent three years in New Jersey writing scripts for training films. After his discharge, he continued spinning out science-fiction and monster comics for Timely, which was renamed Atlas.

In 1947, he married Joan Boocock, a British-born hat model. Mr. Lee credited his wife with pushing him to create the Fantastic Four instead of leaving Marvel in frustration at midcareer. His breakthrough against the industry’s self-imposed comics code came in 1971, when the government asked him to produce a Spider-Man story line that came down harshly on drug use.

The code had a zero-tolerance policy for drugs, even in a negative light, but Marvel ignored the regulations, published without the seal of approval and saw no change in sales. Comic books across the industry stopped following the code’s guidelines.

Mr. Lee moved from editor to publisher in 1972 and then moved to Hollywood around 1980, attempting with little success to attain cinematic respectability for his characters. The few projects that came to fruition, such as “Howard the Duck” (1986) and “The Punisher” (1989), were critical and commercial failures.

In 1999, Mr. Lee entered the Internet age with the company Stan Lee Media, which produced Web cartoons and briefly gave Mr. Lee a fortune worth $100 million on paper. The company collapsed in 2001 amid allegations of a massive scam run by Mr. Lee’s partner, Peter F. Paul, who turned out to be a felon. Paul fled to Brazil but eventually returned to the United States and pleaded guilty to securities fraud.

In 2002, “Spider-Man,” directed by Sam Raimi and starring Tobey Maguire, opened at the box office and eventually grossed more than $800 million worldwide. Citing a previously ignored line in his contract, Mr. Lee sued Marvel for 10 percent of the profits in what he told Variety was “the friendliest lawsuit in the world.” He won the case in 2005. Retaining his lifetime contract with Marvel, he started a new comic company, POW! (Purveyors of Wonder) Entertainment.

The first X-Men and Spider-Man films turned Marvel characters into box-office juggernauts. In the past decade alone, the Marvel Cinematic Universe has grossed more than $17.5 billion globally.

In 2008, he received the National Medal of Arts, the highest honor given to artists by the U.S. government. Yet his final years were fraught with legal tensions. His circle of business partners and confidants had shifted tumultuously since his wife, who often guarded his interests, died in 2017. Not long after, court documents showed that the Los Angeles Police Department was investigating claims of elder abuse against Mr. Lee that involved a road convention manager, a memorabilia dealer and an excommunicated caregiver, among others.

Yet in April 2018, he gave an interview to the New York Times in which he said that “life is pretty good” and added that he had been “very careless with money.”

Survivors include his daughter, Joan Celia “J.C.” Lee; and a brother, comic book artist and writer Larry Lieber. Another daughter, Jan, died days after her birth in 1953.

Mr. Lee, who has had cameos in many Marvel-based films, was known for an economy of humility. As a teenage boss at Marvel, he would sit on a file cabinet and yell, “I am God!” at his artists sitting below. In his memoir, he said, “If I may be totally candid, I’m my own biggest fan.”