Men will no longer require a prescription to obtain the impotence drug Viagra and will instead be able to buy it over the counter at pharmacies.
The decision by the UK Medicines and Healthcare products Regulatory Agency follows a public consultation.
It will be up to pharmacists to judge whether men over the age of 18 can safely be sold the little blue pills.
Manufacturer Pfizer hopes to get stocks of Viagra Connect (sildenafil 50mg) into UK pharmacies by spring 2018.
Experts say making the medication more widely available will help men who might not feel able to visit their GP about impotence.
The MHRA hopes it will stop some men buying unregulated medicines from websites operating illegally.
Mick Foy, MHRA's group manager in vigilance and risk management of medicines, said: "This decision is good news for men's health.
"Erectile dysfunction can be a debilitating condition, so it's important men feel they have fast access to quality and legitimate care, and do not feel they need to turn to counterfeit online supplies which could have potentially serious side-effects."
Pharmacists will decide whether treatment is appropriate and can offer advice on erectile dysfunction, usage of the medicine, potential side-effects and whether further consultation with a general practitioner is required.
Viagra Connect will not be sold to:
Men who are sold it will be advised that they can take a 50 mg tablet an hour before having sex, but should not use more than one pill a day.
Sildenafil is already available on NHS prescription free of charge.
Most men occasionally fail to get or keep an erection.
This is usually due to factors such as stress, tiredness, anxiety or drinking too much alcohol, says NHS Choices.
Men should see their GP or go to a sexual health clinic if erection problems keep happening because it can be a sign of an underlying health condition, it advises.
The MHRA received 47 responses to its consultation, with 33 in support of making viagra available off prescription and one 'unsure'.
The 13 that did not support the proposal included eight pharmacists. Some were concerned that customers might withhold medical information from staff in order to get the treatment. Risk of abuse or misuse of the drugs was another worry.
In reaching its decision the MHRA judged that the benefits of permitting Viagra to be sold without a prescription would outweigh potential risks.
Denise Knowles, psychosexual therapist and counsellor at Relate, warned that taking a pill was not a sticking plaster for relationship problems.
"Many of the people I have spoken with have a misconception that it will give them a stronger erection or add to their desire. But it's not there to enhance prowess.
"It's not a magic pill that will cure problems in a relationship."