The decision by the Scottish Medicines Consortium (SMC) brings Scotland in line with England, where patients have already been able to get the drug Vemurafenib.
Up until now the only option for those in Scotland with metastatic melanoma, where their cancer has spread, has been chemotherapy.
But research suggests Vemurafenib could extend the life of such patients, with a trial showing those taking the drug lived for 13.6 months compared to 9.7 months for those given chemotherapy.
The medication - which is also known as Zelboraf - targets the activity of the faulty BRAF V600 gene, which is present in half of all patients with inoperable metastatic melanoma.
The SMC had turned down the drug for use by the NHS when it considered it last September, but the treatment has been available for patients in England from March 2012, first via the cancer drugs fund and then after it was approved by the National Institute for Health and Care Excellence (Nice), the body south of the border which considers such issues.
Dr Marianne Nicolson, consultant medical oncologist from Aberdeen Royal Infirmary, welcomed the decision to approve the drug, saying: "Advanced melanoma is an aggressive cancer affecting many patients who are in the prime of their lives.
"The decision by the SMC to allow NHS clinicians in Scotland to prescribe Vemurafenib for BRAF mutant melanoma patients will enable our patients to benefit from the welcome, long awaited breakthrough in the management of advanced metastatic melanoma."
Cancer charities also welcomed the decision, with Leigh Smith, chair of Melanoma Action and Support Scotland charity (MASScot) saying she was "delighted" the drug had been approved.
She added: "We are aware from trials in which Scottish patients participated that Zelboraf can greatly improve the quality of life as well as extending it. Thank you to all involved in development, clinical trials and in particular those brave patients who participated in trials."