PORTLAND — As much as 5 inches of rain will soak the state through tonight, the National Weather Service said.

“It’s only bad weather if you don’t like rain,” said Margaret Curtis, a meteorologist with the Weather Service.

Curtis said the heaviest rain was expected to continue to fall between Portland and the midcoast and inland to Augusta. Rainfall is expected to total 3 to 4 inches in the foothills, she said.

The weather service issued a coastal flood warning for Maine, she said, because of an astronomical high tide tonight that would be about 11 feet, 7 inches in Portland, about a foot higher than normal.

With the rain and winds gusting more than 40 mph offshore, she said, areas normally susceptible to coastal flooding, such as parts of Commercial Street in downtown Portland, are likely to be underwater.

Curtis said the weather service is also monitoring the water flow in the state’s rivers, but none of the major rivers are likely to flood.

However, if a band of heavy rain sets up over creeks and small rivers, they could flood, she said.

The rain is expected to taper off today, although showers off and on are expected to continue into Monday, Curtis said. It’s likely to be Wednesday before the weather dries out completely. she said.

“It’s payback for that beautiful Memorial Day,” Curtis said.