The Fife town is one of several locations in the UK and further afield being bestowed the honour to mark the monarch's 70 years on the throne.
A record number of eight places are being made cities, with Bangor in Northern Ireland, Colchester, Doncaster and Milton Keynes in England and Wrexham in Wales all being similarly honoured, along with Douglas on the Isle of Man and Stanley in the Falkland Islands.
Scottish Secretary Alister Jack offered his "warmest congratulations" to Dunfermline - which was one of the seats of the kings of Scotland in the middle ages, with Robert the Bruce buried in Dunfermline Abbey after his death in 1329.
Mr Jack said: "Being awarded city status can give places a real boost, from helping grow the local economy, to raising its profile, to instilling civic pride.
"For a place with such rich royal history, it is fitting that Dunfermline is becoming a city as we celebrate our longest-serving monarch's Platinum Jubilee.
"Its lovely green spaces and fantastic cultural attractions will ensure that this new city thrives well into the future."
He added that businesses and communities in the area will "enjoy the benefits of this prestigious new title".
Provost of Fife Jim Leishman welcomed the announcement, saying: "The official title of city will give Dunfermline the wider recognition that it deserves as one of the fastest-growing, urban areas in Scotland, offering all the amenities that any modern city could hope for.
"City status will help us grow economically and as a tourist destination and will have a positive impact on Dunfermline and the surroundings.
"Of course, the people of Dunfermline have always known that Dunfermline is a city, that's why we have the City Car Park, the City Hotel and City Cabs but it's great to finally get official recognition of this."
Those bidding for city status as part of the Platinum Jubilee Civic Honours Competition were asked to highlight their royal associations, as well as showcase their unique communities and distinct local identity.
Stanley in the Falklands Islands is the first Overseas Territory to win the competition for city status, while Douglas on the Crown Dependency of the Isle of Man has also claimed the civic honour. The Cabinet Office said that Bangor in Northern Ireland, along with Colchester, Doncaster and Milton Keynes in England, and Wrexham in Wales have also won the honour.
Steve Barclay, Chancellor of the Duchy of Lancaster, said he is "delighted that a record number of locations have been awarded the prestigious city status as part of Her Majesty the Queen's Platinum Jubilee celebrations".
He added: "What was clear to me during the process of assessing each application was the pride that people felt for their communities, local cultural heritage and the royal family.
"As we celebrate Her Majesty the Queen's colossal contribution to society, I am thrilled that we are able to recognise some of the many places that make Britain great.
"It is also incredibly reflective of Her Majesty's global outlook and years of international service that applicants from the Overseas Territories and Crown Dependencies have been selected as winners for the first time."