William Powell, the actor who personified the suave and sophisticated leading man in the 1930's and 40's, died yesterday at Desert Hospital in Palm Springs, Calif. He was 91 years old.
Mr. Powell's wife of 44 years, the former actress Diana Lewis, was at his bedside.
The actor's wry, winning cynicism brightened such classics as the comedy-murder mystery ''Thin Man'' series, the farce ''My Man Godfrey,'' the musical spectacle ''The Great Ziegfeld'' and the period comedy ''Life With Father.''
Mr. Powell's ideal foil was the chic and peppery Myrna Loy. They co- starred 13 times, including six ''Thin Man'' movies in which he, as a retired sleuth, Nick Charles, and she, as his tag-along socialite wife, Nora, matched martinis and mirth, sharing amiable brickbats and trapping wrongdoers in the urbane movies from stories by Dashiell Hammett.
Their zest and bantering affection showed that marriage could be merry. They started a vogue of madcap detective films, and many impressionable viewers, believing they were also married offscreen, wrote them, seeking advice on marital problems.
In a statement yesterday, Miss Loy recalled, ''I never enjoyed my work more than when I worked with William Powell. He was a brilliant actor, a delightful companion, a great friend and, above all, a true gentleman.'' Nominated for 3 Oscars
A major triumph in the more than 90 movies made by the dapper actor was his superb portrayal of the benevolently irascible Clarence Day Sr. in ''Life With Father'' (1947) adapted from the record-breaking play.
That movie, along with the comedy ''The Senator Was Indiscreet,'' in which he played the title role of a charming bumbler, won him the 1947 best-actor award of the New York Film Critics. He was nominated for three Oscars as best actor, in 1934 for ''The Thin Man,'' the first in that cycle; in 1936 for ''My Man Godfrey,'' and for ''Life With Father.''
Mr. Powell was noted for his trim mustache, impeccable attire and resonant voice. He was not handsome in the accepted Hollywood sense. His face was considered suited more to sinister than romantic roles, and throughout the silent-film era he invariably played cads and other villains.
But sound movies projected his polished charm and wit, making him a highly paid hero and leading box-office star for more than two decades. Subtle Humor in All Roles
The actor had a meticulous sense of timing and rehearsed his roles at home, reading his lines aloud to himself. When he reached stardom, he also helped polish his scripts.
In progressing from ''heavies'' to character roles to leading men, he injected subtle comic qualities into his characterizations, transforming even scoundrels into plausible and even somewhat humane characters, no matter how menacing their actions might be.
An interviewer reported in 1949 that Mr. Powell spent most of the time on a set deleting his dialogue, prefering a gesture to a page of conversation. ''It's easier,'' he remarked.
His quip belied his serious view of his craft. In an earlier interview he was asked how he kept trim. ''I highly recommend worrying,'' he replied. ''It is much more effective than dieting.'' Born in Pittsburgh
William Horatio Powell was born in Pittsburgh on July 29, 1892. He started making speeches soon after he could talk, according to his mother, the former Nettie Brady. She and his father, Horatio Warren Powell, an accountant, wanted him to become a lawyer, but the boy was drawn early to Pittsburgh's Bijou Theater, where he haunted the gallery, studied the performers and, at home, imitated the actors.
In 1907, the family moved to Kansas City, Mo. He attended the University of Kansas, but dropped out after one week to study acting at the American Academy of Dramatic Arts in Manhattan.
In 1912, he played three bit parts in a play that closed after two weeks on tour and then he did a vaudeville stint. The next year, at the age of 21, he became the featured villain in a road company of the melodrama ''Within the Law,'' playing the role for nearly two years.
After appearing in more than 200 plays, he entered silent movies in 1921 as the arch villain in ''Sherlock Holmes,'' with John Barrymore in the title role. '' Among his best performances in about 30 silents was his role in the 1926 film adaptation of ''Beau Geste,'' which starred his friend Ronald Colman.
Later that year, Mr. Powell made his first talking picture, ''Interference.'' Sound freed the actor from the stereotype of the oily scoundrel or social roue. James Robert Parish and Don E. Stanke wrote in their 1975 book, ''The Debonairs,'' that, ''because of the amazing aura of his civilized manner,'' Mr. Powell ''could tread on any side of the law in a film and still retain audience sympathy.'' Nick and Nora an Ideal Team
He was starred as S. S. Van Dine's resourceful sleuth, Philo Vance, in ''The Canary Murder Case'' and three sequels.
The team of William Powell and Myrna Loy was formed at Metro-Goldwyn-Mayer in 1934. Trailed by their perky wirehair terrier, Asta, they drolly hobnobbed with a motley range of suspicious characters in ''The Thin Man'' and sequels in 1936, 1939, 1941, 1945 and 1947.
The year 1936 was a banner one for the actor with such performances as the title role in ''The Great Ziegfeld,'' which won an Oscar as the best movie of the year, and as a rich man turned butler in the screwball comedy ''My Man Godfrey,'' co-starring Carole Lombard.
In 1937 the actor's career was halted for more than a year by what was then described as a stomach and abdominal ailment, requiring several operations. Decades later, he acknowledged that the illness had been rectal cancer. He was treated with radiation, pronounced cured, and told an interviewer in 1963, ''I was one of the lucky ones.''
The actor sought for years to play the individualistic 1880's patriarch in ''Life With Father,'' and reviewers acclaimed it as his finest performance.
The actor was married three times to actresses: Eileen Wilson, briefly to Miss Lombard and in 1940 to Diana Lewis. The first two marriages ended in divorce. He was also romantically linked with Jean Harlow in the year before her death in 1937. He had a son by his first wife, William David Powell, a story editor and producer who committed suicide in 1968. Shunned the Night Life
Off camera, the actor was known to acquaintances as reserved and businesslike and to intimates as a wry eccentric who savored practical jokes. ''Cultivate solitude and quiet and a few sincere friends,'' he said, ''rather than mob merriment, noise and thousands of nodding acquaintances.''
The nearly six-foot-tall actor came to dislike being described as suave and sophisticated. Although he was once called one of Hollywood's best-dressed men, he paid little attention to clothes.
Mr. Powell's later roles were again character types, and he won particular praise for his final performance, that of a bored Navy ship's doctor in the 1955 comedy ''Mister Roberts.''
In the mid-1950's he retired to Palm Springs to play golf, oversee his investments and lead a leisurely life with his wife in their desert sanctuary.