The hottest three-day stretch in Summer in San Francisco is about to ease.

Scorching 90-degree temperatures baked the city for three days straight, and the heat persisted overnight Tuesday with temperatures in the 70s.

Finally, when the sun came up Wednesday morning, a gentle ocean breeze picked up and the mercury dropped to 67 degrees.

"The west wind is returning at the Golden Gate," says National Weather Service forecaster Ryan Walbrun. "We can see a fog bank offshore."

Relief from the sweltering weather is finally on the way, but the mid-June heat spell that sent some San Francisco residents shopping for air-conditioners have left many wondering, 'Was that normal?'

Meteorologists all seem to agree it's out of the norm for the coastal city, especially for June.

"While June heatwaves are not rare in more inland portions of California, the searing temperatures experienced this week along the immediate coastline are extremely rare — if not historically unprecedented in some places," said Daniel Swain, a climate researcher at UCLA and the author of the Weather West blog.

Coastal June heat is rare in the Bay Area due to chilly ocean water immediately offshore from upwelling of cold water from the deeper ocean.

"That cool water, combined with gentle sinking motion in the atmosphere in early summer, produces San Francisco's famously foggy conditions and provides natural air conditioning to most of the Bay Area — making it hard for inland heatwaves to extend all the way to the coast this early in the season," Swain explained.

By September, the ocean temperatures trend warmer and offshore winds that blow hot air from inland areas toward the coast minimize fog, allowing for occasional heat waves that stretch from the coast to inland valleys.

The data also reveals the rarity of this week's event. Take the 100-degree reading from San Francisco Airport on Monday — that's the first time the airport has seen the mercury hit 100 ever outside of September.

What's more, the National Weather Service reports the combination of hot afternoons and mild nights resulted in the hottest three-day stretch in San Francisco in meteorological summer (June through August) with records going back to the Gold Rush. When you include September, it's the fifth hottest stretch.

While San Francisco saw three days of 90-degree weather, inland valleys baked in widespread record-breaking temperatures that soared into the mid-100s. This excessive heat was the result of a hot mass of air over the region and an unusual wind pattern. The ocean breeze that usually keeps the coast cool in June was nonexistent, while an offshore wind picked up, carrying the hot inland air toward the sea.

"What I'm seeing is temperatures are about the same from Concord toward the coast," NWS forecaster Steve Anderson said of the weather earlier in the week. "It's all pretty much hot out there. It's like there's not even an ocean near us."

With the wind-pattern finally changing to a more typical June pattern on Wednesday, San Francisco isn't expected to break out of the 70s. The coastal breeze and cooling from the fog isn't likely to impact the valley areas until later in the week.

"The marine layer is very shallow so they're still going to have another hot day," Walbrun said. "Probably not the record-breaking heat. We probably won't see many temps over 100 but we still expect to see a lot of 90s for all the inland valleys."

Walbrun says we're headed into a normal summer pattern with cool weather on the coast and temps in the 80s and 90s inland, but he adds the past few days of weather haven't been typical.

"Anytime you're breaking records for two or three consecutive days it's unusual," he said.

Amy Graff is a news producer for SFGATE. Email: agraff@sfgate.com.