Stock markets in the United States have been setting records lately, despite economic conditions that hardly seem like a recipe for boom times on Wall Street.

Gasoline has jumped above $3 a gallon in price, yet the Dow Jones Industrial Average recently pushed above 13000 for the first time in its history.

Economic activity in the US is slowing, due in part to a housing-market slump, yet the Standard & Poor's 500 index is flirting with its historic high of 1527.46 set in 2000.

What gives? How far can this stock market go?

One explanation for the bullish performance could be that Wall Street is misreading an economy that faces trouble on several fronts. That would be bad news for future profits.

But other explanations are more prevalent among financial professionals. Two factors in particular stand out: strong conditions beyond US borders and a merger binge that is pushing up share prices of target companies.

"A lot of major companies have done very well with their overseas markets," says Robert Carey, chief investment officer at First Trust Advisors, an investment firm in Lisle, Ill. "The distinction between US companies and foreign companies is getting very hard to draw."

Companies like IBM, Coca-Cola, and Intel – all among the 30 in the Dow Jones Industrial Average – derive well over half their revenue stream from overseas.

In the final quarter of 2006, US-based corporations saw the earnings of their foreign affiliates surge to an annualized level of $272 billion, up 38 percent from the pace in the fourth quarter of 2005. That amounts to about 15 percent of all US corporate profits, as measured by the US Commerce Department.

Emerging markets such as China are a key source of growth for American corporations. But lately, US exports have also been aided by a stronger economy in Europe, where more than half of those foreign-affiliate profits come from.

Record profits, meanwhile, give corporations and investors lots of money to invest. Many companies are buying back some of their own outstanding shares, a tactic for returning profits to shareholders.

Others are using the money as fuel for takeovers.

The merger wave has buoyed share prices in the US and beyond. Media companies such as Dow Jones and Yahoo are among the stocks that have surged early this month on rumors of possible acquisition (by News Corp. and Microsoft, respectively).

Treasury Secretary Henry Paulson, speaking on May 3 to students at the Harvard Business School in Boston, called the past three years "a global economy that's as strong as anything I've seen in my business career."

For now, the good times for American businesses are rolling along, even though forecasters agree that the rate of profit growth is slowing from double-digit rates.

Mr. Carey is in the upbeat camp of investing strategists who think the stock rally has room to run this year – with the Dow reaching 14000 by year-end in a First Trust Advisors forecast.

"The issue is profits," he says. "This quarter has been a complete shock to a lot of people," as earnings handily beat expectations.

The share price for the S&P index is now about 16 times the earnings for its 500 companies, Carey says. That doesn't qualify as cheap on Wall Street. But "it's a pretty reasonable multiple," he says.

Certainly, it reflects a more balanced investor mood than existed in early 2000, just before the dotcom stock bubble burst, which helped set the stage for a wider sell-off.

But if some analysts see the Dow heading from 13000 to 14000 and beyond this year, many also say it could be a volatile ride. Some say it's a good time to remember an old adage on Wall Street: "Sell in May and go away." Historically, the period from May through October has been less favorable for share prices than the winter-to-spring period.

Already, the Dow has had a strong run-up this year. The widely watched index of large US firms traversed from 12000 to 13000 in just 126 days, hitting the new milestone on April 25. In trading Monday morning, the Dow stood near 13300, while the S&P 500 index was a bit above 1500.

Risks loom ahead on several fronts. One debate on Wall Street is how long the tide of profits from overseas – and the merger boom – will continue.

The rest of the world isn't immune from a slowdown in the US, which remains the globe's largest economy and biggest importer of goods. In addition, the large cash pools that are driving corporate mergers could dwindle if economic conditions turn for the worse.

For now, most economic forecasters see no recession looming for the US, despite the housing-market head winds. Yet some of the best-performing stocks recently have been companies that typically do well during slowdowns – relatively "safe" industries such as healthcare, utilities, and telecommunications, according to economists at Merrill Lynch.

"We are due for a [downward stock market] correction, but there's no way of knowing when that might be due," says Michael Cosgrove, who publishes the Econoclast, a market newsletter based in Dallas. He expects stocks to generally post returns of 6 to 8 percent annually over the next several years, but with downs as well as ups along the way. Inflation, and the threat of new government policies that restrict trade or raise taxes, are among the risks to shares prices, he says.

Another economist who tracks the markets, David Ranson, says recent highs in the price of gold – above $690 an ounce – are an indicator of more inflation on the way. This is a question widely debated among economists, and a key topic for Federal Reserve policymakers as they meet in Washington this week. If inflation persists even as the economy slows, that could push up interest rates, making life tougher for corporations that now enjoy a low cost of capital.

Still, Mr. Ranson, who heads H.C. Wainwright & Co., Economics in Hamilton, Mass., expects US stocks to end the year modestly higher than they are today.