NEW YORK (AP) -- U.S. stock indexes fluttered up and down Thursday, then ended the day a hair above where they started. The slight gains were enough to nudge the Nasdaq composite to another record and the Standard & Poor's 500 index to within a whisper of its all-time high.
It was the second straight day where indexes made only modest, meandering moves, a downshift from big gains made early in the week. The Standard & Poor's 500 index rose 1.32 points, or 0.1 percent, to 2,388.77 and is within a third of a percent of its record.
The Dow Jones industrial average added 6.24 points, less than 0.1 percent, to 20,981.33. The Nasdaq composite rose 23.71, or 0.4 percent, to 6,048.94 and reached a closing high for the third time in four days.
Gains by Under Armour, Comcast and other companies reporting stronger-than-expected profits on Thursday helped to offset a slump in energy stocks. The encouraging reports added to the lengthening list of companies saying they earned more in the first three months of 2017 than Wall Street had forecast. Analysts expect this to be the strongest quarter of growth in years.
The reports have helped lift stocks and temper concerns, at least a bit, that the market had grown too expensive.
"Expectations were high, and they needed to deliver, so thankfully they have delivered," said Nate Thooft, senior portfolio manager at Manulife Asset Management. "As long as earnings continue to follow through and economic data doesn't roll over materially, stocks can keep going. People will say that valuations are expensive, but I would say, 'Yeah, but not relative to fixed income.'"
Under Armour jumped to the biggest gain in the S&P 500 after reporting bigger profits than analysts expected. A rise in sales abroad, particularly in Asia, helped push its revenue to $1.12 billion from $1.05 billion in last year's first quarter. The company's A-class shares climbed $1.96, or 9.9 percent, to $21.67.
PayPal Holdings jumped $2.74, or 6.2 percent, to $47.15 after also reporting stronger revenue and earnings than Wall Street had forecast.
Comcast's A shares rose 80 cents, or 2.1 percent, to $39.59 after stronger revenue at theme parks it acquired as part of its NBCUniversal purchase helped it to report stronger first-quarter results than analysts expected.
Even some of the day's losers reported better-than-expected results. American Airlines fell $2.42, or 5.2 percent, to $43.98, for example. Investors were paying more attention to its plans to raise pay for pilots and flight attendants, which would erode future profits, than its earnings from the latest quarter.
Energy stocks were also weak, slumping with the price of oil. Benchmark U.S. crude dropped 65 cents, or 1.3 percent, to settle at $48.97 per barrel, while Brent crude, which is used to price international oils, fell 38 cents to $51.44 a barrel.
Noble Energy lost $1.59, or 4.7 percent, to $32.57, and offshore-drilling contractor Transocean fell 39 cents, or 3.4 percent, to $11.06.
The incremental moves made by stock indexes the last two days belie the many crosscurrents coursing through the market. Stocks jumped early in the week, in part on relief following the first round of France's presidential election. Results indicate France may not try to break apart from the European Union.
Washington is also a big factor. White House officials unveiled the broad outlines of a tax plan Wednesday, though many specifics are still to be determined. Expectations for lower taxes, plus less regulation for businesses, have helped drive stocks higher since November. A potential shutdown of the federal government also looms unless Congress can agree on a spending bill.
In European stock markets, the French CAC 40 fell 0.3 percent, the German DAX slipped 0.2 percent and the FTSE 100 in London dropped 0.7 percent. In Asia, the Nikkei 225 in Japan slipped 0.2 percent, South Korea's Kospi added 0.1 percent and the Hang Seng in Hong Kong rose 0.5 percent.
The price of gold rose $1.70 to settle at $1,265.90 an ounce, silver slipped 10 cents to $17.27 per ounce and copper fell a penny to $2.58 per pound.
Natural gas slipped 3 cents to settle at $3.24 per 1,000 cubic feet, heating oil fell 3 cents to $1.51 per gallon and wholesale gasoline dropped 4 cents to $1.55 per gallon.
The euro fell to $1.0882 from $1.0899 late Wednesday while the dollar slipped to 111.23 Japanese yen from 111.38 yen. The British pound rose to $1.2903 from $1.2843.
Treasury yields ticked lower as government bond prices rose. The 10-year Treasury yield edged down to 2.29 percent from 2.30 percent late Wednesday.