NAPLES, Fla. — Across coastal Florida, the dreaded storm surge from Hurricane Irma — caused when ferocious winds pile up ocean water and push it onshore — was not as bad as forecast. While some areas were hard hit, notably the Florida Keys and Marco Island, residents of neighborhoods north to Fort Myers, Sarasota and Tampa Bay were expressing relief.

That bit of good fortune was the product of some meteorological luck.

Because a hurricane’s winds blow counterclockwise, the precise path of the storm matters greatly for determining storm surge. Had Irma lingered far enough off Florida’s Gulf Coast, its eastern wall, where the strongest winds occur, could have shoved six to nine feet of water into parts of Fort Myers and Naples, while swamping Tampa Bay and St. Petersburg as well.

At the last minute, Irma unexpectedly veered inland right before it got to Naples, taking its eastern wall safely away from the ocean. That meant that as the storm tracked north over Naples, Fort Myers and Tampa Bay, the winds at the head of the storm were moving west and actually pulling water away from the shoreline. In Tampa, water levels dropped five feet below normal, and bewildered spectators walked out to see beaches sucked dry. In Sarasota, a manatee became stranded.