By Anora Mahmudova and Carla Mozee, MarketWatch

NEW YORK (MarketWatch)--The U.S. stock market closed higher on Friday after the main benchmarks picked up steam in late afternoon, trimming weekly losses.

The S&P 500 (SPX) closed up 2.89 points, or 0.2% at 1,967.57 and finished the week 0.9% lower. The Dow Jones Industrial Average (DJI) gained 28.74 points, or 0.2% to 16,943.81, bur recorded a 0.7% weekly loss.

The Nasdaq Composite (RIXF) added 19.29 points, or 0.4%, higher at 4,415.49 but was 1.6% lower over the week.

Read the recap of MarketWatch's live blog of Friday's stock-market action.

Kim Caughey Forrest, senior equity analyst at Fort Pitt Capital, explained the reason behind shallow pullbacks: "There are lots of investors with cash who missed out on spectacular gains in 2013, so every time they see a dip, they are buying it. I suspect that often it is a retail investor, because institutional investors are more disciplined."

Banking heavyweight Wells Fargo & Co. (WFC) kicked off the reporting season for the financial sector with headline earnings that were in line with expectations. The stock closed 0.7% lower as analysts delved into the details.

Amazon's (AMZN) stock climbed 5.6%. The company unveiled new products for its successful Amazon Web Services business, including new systems for collaboration and mobile.

Tobacco giant Reynolds American Inc. (RAI) confirmed it is in talks with Lorillard Inc. (LO) about a possible acquisition. Lorillard shares rose 4.6%.

Mortgage insurers, including Genworth Financial Inc.(GNW), fell in response to new proposed capital requirements by the Federal Housing Finance Agency. Genworth slid 2.6%.

Fastenal Co.(FAST), which makes fasteners, tools and other industrial and construction supplies, fell 4.2% in the wake of second-quarter earnings.

Fed speakers

There were two opposing views from Fed speakers on Friday. Charles Plosser, president of the Philadelphia Fed, said the central bank "should consider hiking rates in response to the improving outlook. We should not be keeping rates at zero until we meet all our objectives."

In contrast, Dennis Lockhart, the president of the Atlanta Fed, said the central bank should hold short-term interest rates close to zero for another year.

European stocks bounce, oil drops

In overseas markets, European stocks bounced back Friday after Thursday's drop, which came as Portuguese conglomerate EspĂ­rito Santo International SA this week missed a payment on some short-term debt. That sent shares of its subsidiaries, Banco Espirito Santo AS and Espirito Santo Financial Group SA, spiraling lower.

Overnight in Asia, Japan's Nikkei Average fell 0.3% and Hong Kong's Hang Seng Index ended flat.

Among commodities, oil futures(CLQ4) dropped below $101 a barrel on Friday to mark a fourth weekly loss and their lowest close in two months. Gold futures(GCQ4) settled lower on Friday, but still scored their sixth straight weekly gain as traders gauged the risks posed by a troubled Portuguese bank.

More must-reads from MarketWatch:

2,000 days of Obama's presdency: How have stocks done?

Best trade for the rest of the summer

Percent of uninsured in U.S. drops steeply to record low, survey says

Subscribe to WSJ: http://online.wsj.com?mod=djnwires