By James Ramage 

The dollar rose to a five-week high against other currencies Tuesday as concerns over the debt crisis in Greece and tumbling equities in China sent investors into assets they perceive as safe.

The Wall Street Journal Dollar Index, which compares the U.S. dollar against a basket of 16 currencies, gained 0.4% to 87.61, heading toward its highest closing level since June 1.

The dollar gained 0.9% against the British pound, with one pound buying $1.5464. The greenback traded flat versus the yen at Yen122.60, halting a three-day losing streak. The Japanese currency is also considered a haven asset.

The dollar pushed 0.4% higher against the common currency Tuesday, with one euro buying $1.1011. The greenback had pushed the euro as low as $1.0916 earlier in the session before the common currency pared losses during the afternoon on reports that eurozone leaders were discussing proposals to provide Greece with emergency financing.

Investors had moved into the dollar over fears that a failure for Greece and its creditors to reach a new bailout deal would push the country closer to exiting the eurozone.

During the latest meeting of eurozone leaders, Greece sought a deal that would secure interim financing until the end of the month in exchange for passing budgetary measures that, in theory, Greek voters had rejected in a referendum Sunday. News of the discussion boosted the euro, said Brad Bechtel, managing director in Jefferies FX Group.

"That's enough to move investors," Mr. Bechtel said. "We'll see if there's any teeth to it; we've been whipped around by headlines like this for months."

In addition, money managers grew nervous watching Chinese shares fall further, despite the government's recent efforts to keep prices from spiraling lower at a time when the economy and its demand for commodities have been slowing. The Shanghai Composite Index fell 1.3% to 3727.12 Tuesday. The index has fallen 28% from its 2015 closing high of 5166.35, reached on June 12.

Tuesday's moves into the dollar illustrate the confidence of traders and investors about the prospects of the U.S. economy and the Federal Reserve's path for interest rates. The dollar soared to multiyear highs against rivals over the second half of 2014 and earlier this year as expectations for strong U.S. growth and higher U.S. interest rates attracted investors at a time when other developed-market economies battled slow growth and low prices.

Higher U.S. rates make the dollar more attractive to yield-hungry investors. Investors believe the Fed is likely to raise interest rates before other developed markets, even if the timeline for the first increase moves into early 2016, said Lennon Sweeting, a dealer at USForex, which helps U.S. corporations hedge their currency exposure.

"The U.S. is one of the few economies that has experienced stable growth over the last 12 months," Mr. Sweeting said. "There have been misses in the numbers, but it's mostly stood out as an island of stability in the global markets."

Write to James Ramage at james.ramage@wsj.com