NEW YORK - The U.S. stock market stabilized on Tuesday as investors followed the latest developments in the Greek debt saga.

Stocks edged higher a day after the market had its worst day of the year. That slump was prompted by a breakdown in talks between Greece and its creditors. Greece's European bailout program was to end at the end of Tuesday, and the country hadn't yet managed to agree on an extension or a new deal with creditors.

Even though the standoff in Greece is far removed from the United States, the global nature of financial markets will ensure that any ripple effects will be felt across the Atlantic, said Mike Ryan, chief investment strategist at UBS Wealth Management Americas.

"There are obvious concerns that failure to reach some kind of an agreement could put Greece on a path to a eurozone exit," Ryan said. "If there is going to be volatility in global markets, it will be reflected in U.S. markets, as well."

The Standard & Poor's 500 index rose 5.47 points, or 0.3 percent, to 2,063.11 The index closed out the quarter with a loss of 0.2 percent, its first quarterly decline since dropping 1 percent in the last three months of 2012.

The Dow Jones industrial average climbed 23.16 points, or 0.1 percent, to 17,619.51. The Nasdaq composite rose 28.40 points, or 0.6 percent, to 4,986.87.

Despite Monday's slump, many investors remain confident that U.S. financial markets will hold their own.

"Whatever happens here, even if it's the worst-case scenario and Greece drops out [of the euro], the pullback probably wouldn't be gigantic," said Scott Wren, a senior global equity strategist at the Wells Fargo Investment Institute.

In European trading, the Stoxx 50 index of leading European shares fell 1.3 percent. Germany's DAX dropped 1.2 percent, while the CAC-40 in France fell 1.6 percent.

In the U.S., Willis Group Holdings rose $1.50, or 3.3 percent, to $46.90 after the insurance broker said it will combine with Towers Watson in a deal valued at about $18 billion.

Bond insurers, including MBIA and Ambac, fell sharply for a second day as investors followed the debt crisis in Puerto Rico. Credit-rating firm Standard & Poor's said that a default, or a restructuring, of the island's debt within the next six months appeared inevitable.

Puerto Rico's governor said Monday night that he will form a financial team to negotiate with bondholders on delaying debt payments and then restructuring $72 billion in public debt that he says the island can't repay.

"If Greece wasn't happening, this would be a major story right now," said JJ Kinahan, chief strategist at TD Ameritrade.

U.S. financial markets will be closed Friday in observance of Independence Day.