It's impressive literary wizardry by Rowling, who said she relished the freedom of writing "The Cuckoo's Calling" under her pseudonym, Robert Galbraith.
"I hoped to keep this secret a little longer because being Robert Galbraith has been such a liberating experience," she said in a statement released by her publicist on Sunday. "It has been wonderful to publish without hype or expectation, and pure pleasure to get feedback from publishers and readers under a different name."
"The Cuckoo's Calling," a story about a war veteran turned private investigator who is called in to probe the mysterious death of a model, was published to rave reviews in April by Sphere, part of publisher Little, Brown & Co.
The Sunday Times claimed it was investigating "how a first-time author with a background in the army and the civilian security industry could write such an assured debut novel" when it connected the dots. The paper said clues included the fact that Rowling and Galbraith shared the same agent and editor, and that Little, Brown published Rowling's novel for adults, "The Casual Vacancy." It also said the book's style and subject matter resembled Rowling's work.
Rowling's publicist confirmed the paper's detective work was correct, and the news helped the novel climb straight to the top of Amazon's best-selling list Sunday.
It's also left Britain's bookstores unprepared.
Jon Howells, a spokesman for Waterstones, one of the country's biggest bookselling chains, said it had only a handful of copies of "The Cuckoo's Calling" scattered around the country - and they probably sold out on Sunday.
He added that Rowling's feat was "the best act of literary deception since Stephen King was outed as Richard Bachman back in the 1980s." King said he wrote disguised as Bachman so that he could publish more books each year.
In her statement, Rowling thanked her editor David Shelley, the publishing staff who worked on the book without knowing her identity, and the reviewers who praised it without knowing about her authorship.
She added that "Galbraith" planned to keep writing the series, and her publisher said that the second book is expected to be published next summer. Now that her identity is revealed, Little, Brown said "The Cuckoo's Calling" will be reprinted with a revised author biography.
On its website, the publisher marketed the book as a classic crime novel in the tradition of P.D. James and Ruth Rendell. It said the novel, whose central character is named Cormoran Strike, was the first of a series of crime novels to come.
The publisher described Galbraith as an ex-military man, married with two sons, who wrote the novel based on experiences from his military life. Revealingly, it also stated that Galbraith was a pseudonym.
The book received many favorable reviews, including critics who called it "a scintillating debut novel" and who praised Galbraith for his "superb flair as a mystery writer."
Crime novelist Duane Swierczynski said he admired Rowling for choosing to publish in disguise.
"I read the novel, loved it, and wrote an enthusiastic blurb in early January," he said. "Galbraith sounded like someone I'd love to have a beer with. This is still the case, mind you."
Rowling recently turned to writing for grown-ups after becoming the world's most successful living writer with the "Harry Potter" books, which sold more than 450 million copies worldwide.
Reviews for her highly-anticipated novel "The Casual Vacancy," published last year, were mixed. Some praised the book, a bleak tale about class warfare and the darker sides to a community in small-town England, for tackling difficult subjects, but others said it lacked the magic touch that made Rowling's books of wizardry so popular.