By Anna Isaac and Juliet Chung

U.S. stocks rose Friday as a decline for Chevron and concerns about the broader economy were overtaken by earnings reports that showed the world's largest technology companies are thriving.

The S&P 500 rose 0.8% after a rally erased losses in he last hour of trading. The benchmark ended the month up 5.5%, its best performance since April. The Dow Jones Industrial Average rose 0.4%, or 115 points, to 26429 after being down most of the day.

The tech-heavy Nasdaq Composite rose 1.5%.

Nasdaq's gains were driven by Apple, Facebook and Amazon.com as investors cheered the strength of their operations during the coronavirus pandemic. Amazon.com reported soaring quarterly sales and profit after markets closed on Thursday, sending its shares up 3.7%. Apple, which posted better-than-expected sales and unveiled a stock spilit, climbed 10.5%. Facebook's sales continued to expand despite a string of controversies, prompting its shares to climb 8.2%.

But shares in Chevron fell 2.7% after it posted steep losses in the second quarter as lower oil and gas prices offset production gains and the drop in global travel crimped fuel demand amid the pandemic. Caterpillar Inc. also fell after reporting Friday that its revenue in the U.S. dropped more than 40% in the second quarter.

The week has been marked by big swings in major indexes as investors parsed Federal Reserve Chairman Jerome Powell's comments, a slate of mixed corporate earnings and grim economic data showing the economy contracted at a record rate last quarter.

Greg Dowling, chief investment officer at Cincinnati, Ohio-based Fund Evaluation Group, said he viewed the volatility as a partial reflection of big institutional investors sitting on the sidelines.

"They're waiting for stimulus, waiting for the election and waiting for earnings clarity," Mr. Dowling said, adding their opting out has contributed to thin trading volume and volatility in stock prices.

Once large U.S. technology stocks are set aside, the mixed picture for global equities reflects a continuing tug of war in markets, according to investors.

"The push-pull factors remain the same," said Edward Park, deputy chief investment officer at Brooks Macdonald. "We've seen incremental vaccine improvements but the market seems to have priced that in for the medium term. But there is still the risk of a second wave, or an elongated first wave of the virus, deepening China-U. S. tensions and heightened anti-China rhetoric from western allies of the U.S."

Concerns about the health of the American economy were underlined by Congressional leaders and White House officials failing to strike a deal on coronavirus relief Thursday night, just hours before federal jobless benefits officially expired Friday.

Consumer spending, a crucial indicator for the economy's path in the coming months, rose 5.6% in June but appears to have weakened in recent weeks, restraining the economic recovery from the coronavirus outbreak.

The U.S. dollar continued to slide, and is on track to complete its worst month in nearly a decade, according to FactSet. The ICE U.S. dollar index, which measures the greenback against a basket of currencies, edged down 0.1%. Concern over U.S. economic performance, following a sharp contraction in the second quarter, is weighing on the currency, analysts said.

Meanwhile new coronavirus cases in the U.S. climbed back above 70,000 as daily reported deaths rose to their highest level in more than a month Thursday, according to data compiled by Johns Hopkins University.

Analysts said they feared political complications in the U.S. after President Trump floated the idea of delaying the November presidential election for the first time in a tweet Thursday.

"The U.S. GDP data was starkly horrible, there were some political concerns raised by the president talking about delays to the election, but also that the U.S. hasn't dealt with the pandemic as well as other western countries," said Jane Foley, senior currency strategist at Rabobank.

"I do suspect that the rush to sell the dollar is now looking a bit overdone. I would anticipate some pullbacks," she said.

Overseas, the pan-continental Stoxx Europe 600 fell 0.89% Friday from its prior close. That index is down nearly 11 points, or 3%, for the week, its second down week in a row. For the year through July, it is down 59.5 points, or 14.3%.

Jane Buchan, chief executive of Newport Beach, Calif. investment firm Martlet Asset Management, said the strong performance of the tech giants despite several of their executives being interrogated by Congress this week reflected investors' focus on where the economy was headed.

"This whole pandemic has been a quick peer into the future and what the world could look like in two or three years. It's sped up the transition to a New Economy and we're figuring out which are the businesses that are going to be really successful in that economy," she said.

Futures contracts for delivering gold in August rose 1.3% to $1,993.00 a troy ounce. The metal, a traditional haven for investors, is on track for its largest one month percentage gain since February 2016.

The yield on the benchmark 10-year U.S. Treasury ticked down to 0.537% Friday, down from 0.540% on Thursday.

In the Asia-Pacific region, stocks painted a mixed picture by the close of trading. China's major equity benchmark, the Shanghai Composite Index, rose 0.7%. Japan's Nikkei 225 index fell 2.8%, and Australia's S&P ASX 200 index dropped 2%. Both countries face fresh outbreaks of coronavirus after previously managing to contain infections earlier this year.

Write to Anna Isaac at anna.isaac@wsj.com and Juliet Chung at juliet.chung@wsj.com