Shares of the Irving, Texas, company at last check were up 2.2% to $155.41.
For the quarter ended Sept. 30, McKesson reported earnings of $627 million, or $3.54 per share, compared with a loss of $677 million, or $3.99, in the year-earlier period.
Adjusted earnings came to $4.80 a share, while analysts surveyed by FactSet had expected $3.87.
Revenue totaled $60.8 billion, up 6% from a year and ahead of the FactSet consensus estimate of $59.4 billion.
The revenue increase was driven by growth in the U.S. pharmaceutical segment, the company said, due in part to higher volumes from retail national account customers.
Revenue in the U.S. pharma segment was $48.1 billion, up 5% from a year earlier.
Second-quarter revenue in the medical-surgical-solutions segment jumped 23% to $2.5 billion, driven by demand for covid-19 tests and personal protective equipment in the primary care and extended care businesses.
McKesson also updated its guidance range for adjusted earnings per share of $16 to $16.50 in 2021, up from a previous range of $14.70 to $15.50.
"Our strong second-quarter earnings results reflect the breadth of McKesson’s differentiated portfolio and further improvement in volumes across the business," Chief Executive Brian Tyler said in a statement.
"At the same time, we continue to invest into the business to support our long-term growth strategies."
In August, McKesson said it expanded its partnership with the Centers for Disease Control and Prevention. McKesson backs the U.S. government’s Operation Warp Speed as a centralized distributor of future covid-19 vaccines and ancillary supplies needed to administer vaccinations.