Education Secretary Michael Russell visited Spittal Primary School, in Rutherglen, for the ceremony.
To mark the opening it was announced that it would be gifted a tree of the pupils' choice by the Royal Botanic Gardens in Edinburgh.
The Scottish Government has invested £2.4 million in the new building as part of the Scottish Government's £1.25 billion Scotland's Schools for Future programme.
Mr Russell said: "It's a privilege to officially open this fantastic new building.
"Spittal Primary is a great example of the Scottish Government, a local authority and those involved with its construction working together successfully in partnership.
"South Lanarkshire can be proud of this stunning and vibrant new building, which will benefit the children and the community of Spittal.
"I am confident this school and community will, like the tree generously donated by the Royal Botanic Gardens Edinburgh, flourish in years to come."
Councillor Denis McKenna, depute chairman of South Lanarkshire's Education Resources Committee, said: "This ceremony is not only a very special day for me, but one for the pupils and staff as they will go down in the history books as the first pupils to be taught in this fabulous new building.
"I would like to say a big thank you to all involved in the construction of this wonderful new building."
The new Spittal Primary features seven classes, including a nursery class, a gym, kitchen, dining hall, ICT learning centre and a sports pitch.