BANGKOK -- The main river coursing through Thailand's capital swelled to record highs Friday, briefly flooding riverside buildings and an ornate royal complex at high tide amid fears that flood defenses could break and swamp the heart of the city.

Ankle-high water from the Chao Phraya river spilled through one sandbagged entranceway of Bangkok's treasured Grand Palace, which once housed the kingdom's monarchy. The army was pumping out the water, and tourists were still entering the white-walled compound.

The river has filled roads outside the palace gates for days, but the water has receded with the tides, leaving streets dry again.

But the higher-than-normal tides in the Gulf of Thailand, expected to peak Saturday, are obstructing the flood runoff from the north, and there are fears the overflows could swamp parts of downtown. The government also is worried major barriers and dikes could break.

The flood walls protecting much of the inner city are 8.2 feet high, and Saturday's high tide is expected to reach 8.5 feet.

More On This...

Friday's morning high tide passed without a major breach, but the waters briefly touched riverside areas closer to the city's central business districts of Silom and Sathorn.

"It is clear that although the high tides haven't reached 2.5 meters, it was high enough to prolong the suffering of those living outside of the flood walls and to threaten those living behind deteriorating walls," Bangkok Governor Sukhumbhand Paribatra said.

Seven of Bangkok's 50 districts -- all in the northern outskirts -- are heavily flooded, and residents have fled aboard bamboo rafts and army trucks and by wading in waist-deep water. Eight other districts have seen less serious flooding.

New flooding was reported Friday in the city's southeast when a canal overflowed in a neighborhood on the outer parts of Sukhumvit Road.

The floods, the heaviest in Thailand in more than half a century, have drenched a third of the country's provinces, killed close to 400 people and displaced more than 110,000 others. The water has crept from the central plains south toward the Gulf of Thailand, but Bangkok is in the way. The capital is literally surrounded by behemoth pools of water flowing around and through the city via a complex network of canals and rivers.

Economic analysts say the floods have cut Thailand's 2011 GDP projections by as much as 2 percentage points. Damage estimates of $6 billion could double if floods swamp Bangkok.

Most of Bangkok, however, has remained dry and most of its more than 9 million residents were staying put to protect their homes. Still, fears the inner city could flood have fueled an exodus as Thais and expatriates alike seek refuge outside Bangkok and foreign governments urge their citizens to avoid unessential travel to the threatened city.

The U.S. State Department cautioned against all but essential travel to areas of Thailand affected by the flooding, including Bangkok, because of transportation difficulties and shortages of certain food items.

On Thursday, an emotional Prime Minister Yingluck Shinawatra acknowledged her government could not control the deluge.

"What we're doing today is resisting the force of nature," Yingluck told reporters. She said the water bearing down on Bangkok was so massive that "we cannot resist all of it."

Flooding has closed Bangkok's Don Muang airport, mainly used for domestic flights, but Thailand's main international airport is operating as usual.

The government's Flood Relief Operations Center says its contingency plan involves the Thai military and government agencies transporting people from evacuation points in the capital to outlying provinces.