General Motors Corp. headquarters in Detroit (© Paul Sancya-AP Photo)
If someone had told me four or five years ago that General Motors (GM) would beat Toyota (TM) in the closely followed J.D. Power Initial Quality Study, I would have told him he was crazy, because "everybody knows" Japanese cars are built better than American ones. Funny how perceptions don't always match reality.

As Bloomberg News, The Wall Street Journal and other sources have noted, GM just achieved its highest ratings from J.D. Power in eight years and overall beat out archrival Toyota. Indeed, Chevrolet and GMC were the only models from U.S. makers to finish in the top 10 of the survey, which ranks vehicles based on problems reported by owners in the first 90 days after their purchase.

GM's cars are better than they used to be because the company has learned to get the details right.

For one thing, it's listening to customers' complaints, such as those about the door locks on the Chevrolet Camaro being in the vehicle's center console. Designers wisely decided to move them, according to Bloomberg.

And the company is willing to experiment. GM has also found the best way to ensure a flawless paint job is to first dust the vehicle with the feathers of a female ostrich.

The automaker also knew when to leave well enough alone with complex features such as its MyLink entertainment system. As The Wall Street Journal noted, Ford (F) fared poorly in the survey "in large part due to consumer dissatisfaction with the difficulty of using its touch-screen multimedia system, called MyFord Touch." Ford, which the paper says had its worst showing in years, is smartly redesigning the system.

Heaps of praise are coming GM's way.

GM is "much better now at thinking about the consumer when they originally design the vehicle," J.D. Power vice president David Sargent told Bloomberg. "There was a time in the past when they figured they knew how to design and build vehicles and the consumers would buy them."

While it's heartening to see the improvements in GM, the automaker hasn't left the old days behind it completely. The U.S. Treasury, which gave it a $50 billion bailout at the height of the Great Recession, probably will lose money on its investment. The government expects to unload its entire stake by the end of next year.

Federal officials have said the purpose of the loan was to protect jobs and not to make money. And if consumers are getting better cars as well, that's pretty good, too.

Jonathan Berr does not own shares of the listed stocks. Follow him on Twitter @jdberr.

More on moneyNOW