What if you could stop a migraine in its tracks? Many people can with a simple home remedy that’s readily available.

Here’s why: The pain of a migraine headache is usually caused by dilated, or widened, blood vessels, pressing against nerves.

Home remedy: Drinking coffee can constrict those blood vessels, relieving pain.

If you are skeptical, consider this research. A 2012 review of 19 studies involving more than 7,000 people showed that a dose of 100 mg or more of caffeine (the typical amount in a cup of coffee) boosted pain relief in headache sufferers taking painkillers. I’ve found that this approach also can help relieve pain without the use of medication.

What to do: At the first sign of a headache, drink an eight-ounce cup of coffee (or about two cups of black tea). If the remedy is going to help, you should experience pain relief in about 20 minutes.

Coffee is most likely to work if you don’t ordinarily drink it or consume other caffeine-containing beverages, such as tea or energy drinks.

For even greater relief: Try adding an ice pack to the back of your neck or head for a few minutes to further constrict dilated vessels.

Red flags: If you have insomnia, high blood pressure, anxiety or chronic fatigue—all of which coffee can worsen—this remedy probably isn’t for you. Also, for some people, caffeine can trigger a migraine.