Dow, S&P 500 end 4th month of gains at record highs

U.S. stocks turned mostly higher on Friday, with the S&P 500 and the Dow Jones Industrial Average closing at records, after the government reported an unexpected slowdown in consumer spending in April.

" People are still struggling with their incomes and cautious with their businesses. Ironically the market is hitting new highs here on some rather disappointing numbers; GDP yesterday was pretty miserable, but we talked our way through it because of inventories," said Bruce McCain, chief investment strategist at Key Private Bank, referring to a lack of an inventory buildup.

The Reuters/University of Michigan survey of consumer sentiment came in at 81.9 in May, lower than the consensus estimate of 82.4.

The figures from the Commerce Department had household purchases falling 0.1 percent last month in the first decline in a year, following a revised 1 percent rise the prior month, the strongest since 2009. Incomes increased 0.3 percent, as expected.

Read MoreUS consumer spending dips for the first time in a year as prices jump

The Chicago Purchasing Managers Index hit 65.5 in May, versus expectations of 61.

The economy is not ready to "break out and do a lot better and not weak enough where we are going into a recession and a down cycle where we can expect to buy stocks a lot cheaper. It's a tough time for anybody who wants to invest at this point, but sitting on the sidelines is not the answer either," McCain said.

Express declined after the retail chain reduced its yearly profit outlook; Lions Gate Entertainment also fell, a day after the film studio reported quarterly results below expectations; Infoblox dropped sharply after cutting its full-year forecast and saying its CEO would depart. OmniVision Technologies jumped after projecting quarterly earnings would climb more than Wall Street estimates. Shares of Apple turned lower.

S&P 500

Posting a 0.8 percent gain in May, the Dow Jones Industrial Average added 18.43 points, or 0.1 percent, to 16,717.17, topping its May 13 record.

After rising to an all-time high for a fourth session, the S&P 500 climbed 3.54 points, or 0.2 percent, to 1,923.57, also a record. The index rose 2.1 percent for the month, with both the Dow and the S&P tallying a fourth monthly gain.

After an initial rise, the Nasdaq dropped 5.33 points, or 0.1 percent, to 4,242.62, leaving it up 3.1 percent for May.

Advancers moved just passed decliners on the New York Stock Exchange, where nearly 916 million shares traded. Composite volume approached 3.2 billion.

After dropping to lows not seen since last summer, the yield on the 10-year Treasury note used in determining mortgage rates and other consumer loans climbed 1 basis point to 2.474 percent; thedollar declined against the currencies of major U.S. trading partners.

The 10-year yield yield is "signaling economic weakness that isn't yet obvious; we think it's more a matter of supply and demand," said McCain.

Crude-oil futures for July delivery fell 87 cents, or 0.8 percent, to $102.71 a barrel, and gold for August delivery declined $11.10, or 0.9 percent, to $1,246 an ounce.

Read MoreGold tumbles to near four-month low

On Thursday, stocks rose for a fifth day in six, lifting the S&P 500 to another all-time high, as Wall Street bet that the economy would rebound from its first contraction in three years.

Factset Symbol Name Value
MKT.CVOL-BATY BATY Composite Volume 1833300000
MKT.CVOL-BATS BATS Composite Volume 1300000
MKT.CVOL-CBO CBOE Composite Volume 805500000
MKT.CVOL-CHI CHICAGO Composite Volume 562600000
MKT.CVOL-EDGX EDGX Composite Volume 1839500000
MKT.CVOL-EDGA EDGA Composite Volume 1831400000
MKT.CVOL-ADF FINRA Composite Volume 1841000000
MKT.CVOL-CIS NATIONAL Composite Volume 1696300000
MKT.CVOL-NYS NYSE Composite Volume 3204100000
MKT.CVOL-ASE MYSE MKT Composite Volume 105700000
MKT.CVOL-PSE NYSE ARCA Composite Volume 764200000
MKT.CVOL-NAS NASDAQ Composite Volume 1852400000
MKT.CVOL-OTC OTC BB Composit Volume 457200000
Total 20383800000