Strontian Primary School, on the Ardnamurchan peninsula in the Highlands, was built after the community of around 400 people rejected Highland Council's plans to improve their old primary school building.
Community members raised around £34,000 towards the project, with cash coming from the community-owned hydro scheme as well as local donations.
The school building was jointly funded by a commercial loan from Triodos Bank, a payment for tenants' works from Highland Council, a community share offer which raised more than
£155,000, and £80,000 in grants from the Scottish Land Fund and Foundation Scotland.
Deputy First Minister John Swinney said: "It gives me great pleasure to open the first school in Scotland to be developed through a community ownership model.
"The innovative work of parents and the wider Strontian community, alongside construction companies and Highland Council, has given local young people a fit-for-purpose school they can be proud of for years to come."
Kate Forbes, MSP for Skye, Lochaber and Badenoch, said: "The opening of a new school is an exciting day for any community, but this is even more special because it is the community who built it.
"I know that it has not been easy or pain-free but this is an incredible day for Strontian and the surrounding areas. The new school is a great facility for the young people of the peninsula.
"I am delighted that the Deputy First Minister of Scotland came to formally open the school, in recognition that this is not just an important day for the Highlands but indeed for all of Scotland."
Jamie McIntyre, chairman of Strontian Community School Building Ltd, said the community is "delighted" with the new school and thanked all those who made it possible.
He added: "The end result exceeds our expectations and is a real asset for our community which will help retain and attract young families.
"It has been a challenging undertaking for our community. Hopefully our experience will make it easier for other communities to progress similar projects of their own."