Economists polled by Thomson Reuters IFR Markets were expecting about a 5.0 million unit pace.
The median sales price fell 6.3 percent in the past year to $208,600, the fifth-largest annual price decline for records including both condominiums and single-family homes dating back to 1999.
The median sales price of single family homes fell 6.8 percent, while the median sales price for condominiums fell 2.1 percent in the past year.
Sales rose in three of the four regions of the country in May.Sales in the Northeast rose 4.6 percent and sales in the Midwest rose 5.5 percent. Sales in the West, where prices fell the hardest, rose 2.0 percent. Sales in the South, the country's largest region, fell 0.5 percent in May.
The increase in sales led to a decline in inventories, which fell 1.4 percent to 4.49 million units.
At the current sales pace, it would take 10.8 months to deplete the supply of unsold homes on the market, faster than April's 11.2 month pace.
On Wednesday, the government reported that sales of new homes tumbled for the sixth time in seven months in May while median prices kept plunging.
The Commerce Department said new homes were sold at a seasonally adjusted annual rate of 512,000 units in May, down 2.5 percent from the April level.
The median price of a new home sold last month fell to $231,000, down 5.7 percent from a year ago.
The report on new home activity in May followed reports Tuesday that showed record home price drops in April, showing that the nation's housing slump is not only deepening but also widening to include previously untouched parts of the country.
The inventory of unsold homes rose to 10.9 months in May, meaning it would take that long to exhaust the current supply of unsold homes.
Because of the unusually high inventories, economists believe that home prices will keep falling until the spring of next year.
The prolonged problems in housing have dragged down the overall economy, raising the risks of a full-blown recession.
For May, sales were down the most in the West, falling by 11.6 percent.
Sales dropped 7.9 percent in the Northeast but posted increases in the Midwest of 5.1 percent and 0.4 percent in the South.
--AFX and Reuters contributed to this report.