A tiny fraction of the 880,000 doctors and other health care providers who take Medicare accounted for nearly a quarter of the roughly $77 billion paid out to them under the federal program, receiving millions of dollars each in some cases in a single year, according to the most detailed data ever released in Medicare’s nearly 50-year history.

In 2012, 100 doctors received a total of $610 million, ranging from a Florida ophthalmologist who was paid $21 million by Medicare to dozens of doctors, eye and cancer specialists chief among them, who received more than $4 million each that year. While more money by far is spent for routine office visits than any other single expenditure, one of the most heavily reimbursed procedures — costing a total of $1 billion for 143,000 patients — is for a single treatment for an eye disorder common in the elderly.

The Medicare data — all for 2012 and the subject of an intense legal battle — provides an unprecedented look at the practice of medicine across the country, shedding fresh light on the treatment decisions physicians and other practitioners make every day. It will also provide consumers with an ability to compare doctors and treatments in a way they have never had until now.