Stocks closed at session highs Friday, lifted by reports that central banks are prepared to provide liquidity after Sunday's Greek elections and amid growing hopes for action from the Fed in light of some recent disappointing economic data.
Stocks gyrated in a wide range all week, alternating between gains and losses of more than 1 percent for most days, in reaction to various headlines from the euro zone. Still, all three major indexes posted gains for the week.
The Dow Jones Industrial Average jumped 115.26 points, or 0.91 percent, to close at 12,767.17, surpassing its 50-day moving average for the first time since early May, led by BofA and Chevron .
The S&P 500 rallied 13.74 points, or 1.03 percent, to finish at 1,342.84. The Nasdaq gained 36.47 points, or 1.29 percent, to end at 2,872.80.
The CBOE Volatility Index, widely considered the best gauge of fear in the market, slipped to close near 21.
For the week, the Dow rose 1.70 percent, the S&P 500 added 1.30 percent, and the Nasdaq climbed 0.50 percent. Johnson & Johnson led the weekly Dow gainers, while H-P slumped.
All 10 S&P sectors logged gains for the week, led by telecoms and energy.
“[The Greek election] is going to be another kicking the can down the road for a while,” said Art Cashin, director of floor operations at UBS Financial Services. “I’m far more concerned about the election in Egypt…[but] the market has ignored many geopolitical risks out there and we’ve become so obsessed with the Grecian problem that nothing else seems to matter.”
Officials from the G20 nations, who are scheduled to meet next week in Mexico, said central banks were ready to take steps to stabilize financialmarkets by providing liquidity and prevent any credit squeeze if severe market strains emerged after Sunday's election in Greece. (Read More: Why Joint Central Bank Action Won’t Work)
“Even if New Democracy ends up winning, unless you find a way to help Greece’s economy grow when you abandon austerity, this issue’s going to resurface over and over again, leading to increased volatility throughout the year," said Joseph Tanious, market strategist at JPMorgan Asset Management.
Britain is expected pump more than 100 billion pounds ($155.43 billion) into its banking system as it looks to improve the amount of credit being fed through to the real economy, according to the governor of the Bank of England.
Meanwhile, the Bank of Japan kept monetary policy steady but pledged to do its utmost to ensure the country's banking system remains stable if a Greek election this weekend ignites fresh global market turmoil.
European shares closed higher. Spanish and Italian government bond yields eased, while the euro held firm against the U.S. dollar.
Brent crude futures rose near $98 a barrel, extending gains after producer group OPEC agreed to keep its output target unchanged for the second half of the year.
Facebook is expected to file a motion to consolidate all shareholder lawsuits against the company following the botched IPO last month, according to sources. The social-networking giant's lead underwriters, Morgan Stanley, Goldman Sachs and JPMorgan Chase, are expected to join the motion. Facebook soared to close above $30 a share.
On the M&A front, business-software company Yammer agreed to a takeover bid from Microsoft for $1.2 billion, according to reports.
And China granted conditional approval for United Technologies to take over aircraft parts maker Goodrich in a deal valued around $16.5 billion, saying Goodrich needed to divest or sell parts of some businesses.
On the economic front, consumer sentiment tumbled to a six-month low in June, according to the Thomson Reuters/University of Michigan's preliminary reading.
Manufacturing in New York state fell sharply to its lowest level since November, according to the New York Federal Reserve's "Empire State" general business conditions index. And industrial production slipped in May, according to the Federal Reserve.
—By CNBC’s JeeYeon Park (Follow JeeYeon on Twitter: @JeeYeonParkCNBC)
On Tap Next Week:
MONDAY: Housing market index, G20 summit
TUESDAY: Housing starts, FOMC meeting begins, Groupon shareholders mtg; Earnings from FedEx, Discover Financial, Adobe Systems
WEDNESDAY: Weekly mortgage apps, oil inventories, FOMG mtg announcement, FOMC forecasts, Bernanke press conference; Earnings from Bed, Bath & Beyond
THURSDAY: Jobless claims, PMI manufacturing index flash, existing home sales, Philadelphia Fed survey, FHFA home price index, leading indicators, Best Buy shareholders mtg, Google shareholders mtg; Earnings from ConAgra, Rite Aid, Oracle
FRIDAY: Earnings from Darden Restaurants
More From CNBC.com: