The extended smoke-free areas will be put in place by summer 2019.
It has been illegal to smoke inside a public building since the existing smoking ban came into force in 2007.
It is hoped the tightened laws will de-normalise smoking for children and young people and protect others from second-hand smoke.
While most hospitals have a no-smoking policy within their grounds, it is currently very hard for staff to enforce.
During a visit to the maternity unit at Glan Clwyd Hospital, Welsh health secretary, Vaughan Gething spoke to staff who told him they had received complaints from mothers about people smoking outside the hospital when they enter and leave with their young babies.
Complaints had also been raised over smoking by the hospital main entrance.
The new laws making it illegal to smoke in the hospital grounds will be backed up with fines to be issued to smokers breaking the rules.
Commenting on his pride at Wales leading the way in the fight against smoking, Mr Gething said: “We have seen significant changes to the attitudes to smoking since 2007.
“Back then we received some resistance to change, but we have seen a remarkable culture-change and I am pleased our plan to extend smoke-free areas to outdoor public spaces has received overwhelming public support.
“This is another step in the right direction to de-normalise smoking in Wales.”
Smoking contributes most to about 5,450 deaths in Wales each year and costing the NHS an estimated £302m annually.
NHS Wales offers free help and advice to people wanting to give up smoking through Help Me Quit.
The changes to the smoke-free legislation will be introduced under the Public Health (Wales) Act 2017, which was passed by Assembly Members last year.