Nobody hopes for natural disasters. But like it or not, these acts of nature impact companies, and the effects on those companies can create opportunities for investors to make money.

The key is to study stock valuations and buy and sell at the right times. We can use Hurricane Irma as an example. In the days before Irma made landfall in Florida, the stock of Universal Holdings, a south Florida insurer, fell by 26%. Investors feared that damage from the hurricane’s projected path, up the east coast of the state, would bury the company under expensive claims.

But there was a case to be made for buying Universal Holdings during its slump. Insurance companies are typically able to raise premiums after big losses; that can lead to more profits and higher stock valuations.

Luckily for the east coast, Irma tacked west, where the insurance company is not as exposed. In recent days, Universal Holdings was up 27%. But if you believe that a greater bounce is coming once investors fully realize the company’s good fortune, then that stock could be a buy. 

Or look at home improvement stores like Home Depot or Lowe’s. You may have seen photos prior to the storm of homeowners snapping up plywood to protect their windows. Selling out of wood at their stores in Florida will provide a nice boost to these companies’ earnings. One strategy: To buy shares before the firms’ next quarterly earnings reports, in early November. Share prices could pop on “surprising” earnings, which would provide a short-term opportunity to make money.

Then there are the airlines. More than 13,000 flights were canceled due to Irma. That’s bad news for airline companies, but over-reacting investors could push their stocks down to the point where they’re actually good values. What about gas companies? Fuel prices shot up before Irma and are still high—something that will pad earnings for the companies doing the selling.

There’s no guarantee that investments like those above, or investments of any kind for that matter, will make money. But by patiently identifying opportunities created by natural disasters, we have the potential to earn extra returns.