Stocks rallied on Friday as a rebound in bond yields eased fears of a recession that sent stocks tumbling earlier in the week.

The Dow Jones Industrial Average rose 306.62 points, or 1.2%, to 25,886.01, while the S&P 500 gained 1.4%, or 41.08 points, to 2,888.68 and the Nasdaq Composite was about 1.7% higher at 7,895.99. Apple and Nvidia led the gains. The Dow, however, still lost 1.5% on the week.

Bond yields climbed back from their historic lows on Friday. The U.S. 30-year Treasury yield dropped to a record low on Thursday, while the yield on the benchmark 10-year notes dipped to a three-year low, as investors sought out safe-haven assets.

Bank stocks rallied along with the rise in bond yields on Friday as Bank of America and Citigroup gained 3% and 3.5% respectively. The SPDR S&P Regional Banking ETF was up 2.7%, enjoying its best day since June.

The Dow lost 800 points or 3% on Wednesday after the yield on the benchmark 10-year Treasury note briefly broke below the 2-year rate. The inversion of this key part of the yield curve has been a reliable indicator of economic recessions. That part of the curve is no longer inverted Friday and stocks started to move higher as the curve steepened with the rise in yields.

Some traders tied the rebound in bond yields to a report that Germany would issue more debt to stimulate the economy.

"We have been saying this is a buying opportunity and back up the truck," Tom Lee, Fundstrat Global Advisors' head of research, said in a note Friday. "But history and even global comparisons show that the S&P 500 should rally. We realize there are many reasons to tilt bearish — don't forget the White House wants higher stock prices. The Fed does not want stocks to fall. And US consumer may not be paying much attention to inverted yield curves."

Still, major stock averages posted their third straight weekly losses with the S&P 500 down 1%. August has been a volatile and brutal month for the stock market as the Dow has lost 3.6% so far.

Markets closed Thursday's session positively after retail giant Walmart's strong earnings and solid retail sales figures. The Dow ended its volatile trading day higher by almost 100 points after suffering its worst day of the year on Wednesday.

"Yield curve inversions do not point to imminent doom for U.S. stocks," Brian Belski, BMO Capital Markets' chief investment strategist, said in a note. "Historically, it takes a while for big losses to occur once the yield curve inverts."

The U.S.- China trade war is still a big driver of market movements. President Donald Trump this week decided to delay some of the latest China tariffs to December, a move designed to avoid any negative impact on the holiday shopping season. The president also confirmed the two sides will hold talks next month.

"September, the meeting is still on as I understand it, but I think more importantly than September, we're talking by phone, and we're having very productive talks," Trump told reporters on Thursday.

His comments came after Beijing promised it would counter the latest tariffs on $300 billion of Chinese goods but urged the U.S. to meet halfway in order to secure an agreement.

The intensified tensions roiled the markets last week as the Dow suffered its second worst day of the year after Trump threatened to slap those new tariffs on the rest of Chinese goods.

Chip maker Nvidia's stock jumped more than 7% on Friday after it reported better-than-expected fiscal-second quarter earnings. Apple shares gained as investors bought back stocks beaten down by trade war fears.

General Electric, which had its worst day in 11 years on Thursday after accounting fraud claims from Madoff whistleblower Harry Markopolos, rebounded on Friday after CEO Larry Culp called the accusation "market manipulation" and bought nearly $2 million worth of the company's stock. Shares of GE surged 9.7%.

— CNBC's Silvia Amaro contributed reporting