When Elmore Leonard's Stick was published in Britain in 1984, one newspaper called it "a fine first novel". At almost 60, the author would have been amused at such an accolade; it was, in fact, his 21st novel, and Leonard, who has died aged 87, had been selling his fiction regularly, occasionally to Hollywood. But the genres in which he chose to work often failed to attract serious critical attention: westerns first, then crime novels set in the contemporary urban hinterlands.

Westerns as a literary genre still lack respectability, but the craft and energy of Leonard's crime novels, which include Get Shorty, Out of Sight and LaBrava, eventually made them impossible to ignore. Still, recognition came late: only in 1992 did the Mystery Writers of America grant him its highest accolade, the Grand Master Edgar. In 2009, his lifetime achievements were recognised by both the Western Writers of America and PEN USA. By then, Leonard's appeal went far beyond generic boundaries. In 1998, Martin Amis, in the course of a somewhat idolatrous interview with Leonard at the Writers' Guild in Beverly Hills, declared him "as close as anything you have here in America to a national novelist". He also revealed that Saul Bellow had Leonard's work on his bookshelves.

Leonard was born in New Orleans. His father was a General Motors executive whose job entailed a nomadic existence. The family spent the first 10 years of Elmore's life travelling the American south and he retained traces of a southern drawl. After second world war service in the US naval reserve, he graduated with an English degree from the University of Detroit. For 11 years, from 1950, he was employed as a copywriter for a Detroit agency, mostly writing car ads. Interviewed years later, he pronounced adverbs in fiction "a moral sin: I used up all my adverbs when I was writing car catalogues for Chevrolet". Getting up at five every morning and writing fiction for two hours before going to work, he maintained a decent output without relying on it for an income.

After he left the agency, he spent several years providing scripts for educational films, including for Encyclopaedia Britannica films. Here, too, he learned something that stayed with him: "Don't say what you see; don't describe what's obvious." That apparent detachment from an authorial point of view was one of the distinguishing characteristics of his fiction. "I don't want you to be aware of me in my books. I'm not ever telling the story. When you're reading a novel, you don't want people telling you things, you want to see it, to hear it."

By 1967 he was selling enough fiction to abandon advertising. He had sold his first story, Trail of the Apache, in 1951. His earliest fictions, whether short stories or full-length novels, were westerns, because, he later confessed, he liked cowboy movies and he hoped to sell to Hollywood. At first it was magazines that bought his work, not only such pulps as Dime Western and Gunsmoke, but also the more respectable Argosy and Saturday Evening Post. His first novel, The Bounty Hunters, appeared in 1953. Other westerns followed, the titles more generic than the stories themselves: The Law at Randado (1954), Escape from Five Shadows (1956), Last Stand at Saber River (1959).

Like most writers of westerns, he relied on movies for much of his imagery, but Leonard had taken the time to do a modicum of fact-finding, about which he would later be characteristically self-deprecating: "I cribbed most of my research. I subscribed to Arizona Highways, a pictorial magazine with stunning shots of the landscape, full of articles about the old west ... Once I'd done my research, I began to sound as if I knew what I was talking about and my stories began to sell." Much later, he would be able to afford to pay professional researchers.

It was not long before Hollywood took note with The Tall T (1957), directed by Budd Boetticher, and 3:10 to Yuma, based on a 9,000-word story published in 1953, and filmed by Delmer Daves in 1957. Dime Western paid him $90 for the piece, and he got $4,000 for the screen rights: a pittance in comparison to the deals that came his way later (not least when the film was remade in 2007 with Russell Crowe and Christian Bale). His 1961 novel Hombre was filmed in 1967 by Martin Ritt, with Paul Newman among its stars, but, although he got $10,000 for screen rights, Leonard realised that the market for westerns was running dry. Surprisingly, given his talent for dialogue, he wrote few movie scripts: among the more notable were The Moonshine War, for Richard Quine in 1970 (he later "novelised" his own screenplay), and John Sturges's Joe Kidd, in 1972. The latter starred Clint Eastwood, a passable incarnation of Leonard's self-contained heroes.

Writing against the grain, he continued to publish westerns, notably Valdez is Coming (1970) and Gunsights (1979). By then he already had a reputation as a writer of distinctly tough crime novels, beginning with The Big Bounce (1969). Others included Swag (1976) and Unknown Man No 89 (1977). These provided Leonard with his true milieu: street-hardened good guys doing battle against mean and fearless bad guys, not in order to restore the moral order, but as the only way to stay alive in the wildernesses of Miami and Detroit, his preferred locations. Later, he broadened his geographical horizons, writing novels set in Cuba and Rwanda, but Detroit and Miami remained his cardinal points.

What his writing always showed was a sense of how notions of law and order are in abeyance when men get desperate; and desperation, albeit infused with gallows humour, was the atmosphere Leonard's characters breathed. The more he wrote, the more a streak of sentimentality began to emerge, in part an inheritance of his cowboy writings. The structural similarity of his crime fiction to his westerns was sufficiently pronounced for City Primeval (1980) to be subtitled "High Noon in Detroit", but the whiff of danger was always stronger than the perfume of romantic love.

I met Leonard when he was on the interview circuit in London in 1997. By then his fiction had made him a millionaire, not only through sales of his books but also through the income derived from movie rights: Burt Reynolds filmed Stick in 1985 (Leonard provided the script but hated the movie), while Quentin Tarantino's 1997 film Jackie Brown was derived from Leonard's Rum Punch (1992). At the time I met him, Leonard had just finished Cuba Libre, and he enjoyed telling me about his (or his researcher's) studies of 19th-century American obscenities: "cocksucker" was a favoured term at the time, he said, though he hadn't much need to use it; on the other hand, he was particularly pleased to find the word "fly", meaning snappily dressed, in O Henry, when he had thought it 1970s black street-talk. Those kind of linguistic details were an important imaginative hook on which he could hang a character.

Leonard proved an affable talker, filling my allotted hour without effort and then calling a halt gracefully. He had precise recall for names and faces and spoke with fond animosity about the rogues, cheats and charlatans he had encountered in Hollywood decades before. He spoke rather less fondly of some of the films made from his books: of The Big Bounce, filmed in 1969 as a showcase for Ryan O'Neal's winsome good looks, he commented, "I used to say that [it] was the second-worst movie ever made, because there's got to be one worse than that, but I don't know what it would be."

Nevertheless he acknowledged that Hollywood had supported his novel-writing for years. He readily admitted benefiting from Hemingway's influence, although not necessarily more than from writing for Encyclopaedia Britannica films. He had a film-maker's eye for setting up a scene and editing the action within it, yet it was his abrasive dialogue that proved his greatest asset: as Tarantino acknowledged, reading Leonard "helped me figure out my style". He had an acute ear for the stops and starts, the detours, switchbacks and inventive obscenities of conversation. If it felt as if he had simply switched on a tape recorder to catch what he called "the rhythm, the beats", it was in fact the work of a finely tuned imagination.

He occasionally used the same character in more than one novel, and admitted to me that his main character was often "the same guy with a different name". That guy was a tarnished hero, usually but not invariably male, unafraid to break the law but with a fundamental sense of decency, if not of legality. Against him ranged the forces, not of law and order, but of chaos and violence. They were invariably embodied in one wrongdoer whose skills in murder, mutilation and mayhem were chillingly refined.

Each of these villains was a kind of diabolus ex machina whose predictably unpredictable behaviour permitted the action to unfold with maximum risk to everyone they encountered. They, too, might be essentially "the same guy", but each had special talents: Bobby Deo in Riding the Rap (1995), for example, was a careful gardener who found unusual uses for his secateurs.

To call Leonard's style a formula would be to cheapen it, but when he departed from it, the results were less convincing: Touch (1987) was a bizarre fable reflecting Leonard's own discovery of Christianity and his abandonment of alcohol, while Cuba Libre (1998) was a kind of Cuban western, although Leonard failed to find much life in the 1898 Spanish-American war. Touch, Get Shorty (1990), Out of Sight (1996) and Be Cool (1999) were all adapted for the cinema; Out of Sight also spawned a TV series, Karen Sisco. The US marshal Raylan Givens, a secondary character who appeared in both Pronto (1993) and Riding the Rap, later became the focus for the TV series Justified, for which Leonard acted as executive producer. The success of the series prompted Leonard to reintroduce Givens in his 2012 novel Raylan, which in turn borrowed characters from the TV series.

He departed from his usual output with the children's novel A Coyote's in the House (2004). It depicted the tough and often violent lives of a gang of coyotes living on the fringes of human society, or at least of Hollywood. The story shared many of the characteristics of Leonard's crime novels: it was written in a version of his familiar hardboiled demotic, and its coyote characters had names such as Antwan and Ramona, the kind that cropped up in his adult fiction.

In 2001, the New York Times published Leonard's Ten Rules of Writing, folksy but well-considered advice, and not only for those who wanted to write like Leonard: "Never open a book with weather", "Keep your exclamation points under control" and so on. He added: "My most important rule is one that sums up the 10: if it sounds like writing, I rewrite it." Leonard made it sound easy, but of course it wasn't. He may not have been an innovator, but his best novels were a more accurate barometer of contemporary America than the respectable profundities of "quality" fiction, even if it took the critics 30 years to catch up with him.

Leonard married three times, in 1949 to Beverly Cline (the couple divorced in 1977); in 1979 to Joan Shephard, who died in 1993; and later that year to Christine Kent (the couple divorced in 2012). He is survived by the five children of his first marriage, Jane, Peter, Christopher, Bill and Katy. Peter published his first novel, Quiver, in 2008. It bore clear traces of his father's influence, but he was not the only writer who learned from Elmore Leonard.

• Elmore John Leonard, writer, born 11 October 1925; died 20 August 2013