BT is to buy enough renewable energy from a wind farm to match the power consumption of its entire Scottish operations under a deal worth £300 million over the next 20 years.
The communications firm is to buy 50% of the electricity generated by the 48-turbine Fallago Rig wind farm in the Scottish Borders.
The company said the deal will give it "long term price certainty".
BT Scotland director Brendan Dick said: "BT is one of the UK's biggest consumers of electricity, and demand for our digital services, including fibre broadband, means we have to keep innovating to meet our needs in an environmentally responsible way."
He went on: "We're as committed to reducing our own carbon emissions as we are to providing products and services that help everyone live within the planet's resources. We reduced carbon emissions from our own operations by 25.5% globally during 2013/14.
"Our deal with Fallago Rig reinforces our commitment to make a positive contribution to society and the environment. It's also a huge vote of confidence in Scottish renewable energy."
BT, a provider of telecommunications networks and services in the UK, said it uses around 170 gigawatt hours (GWh) of electricity each year in Scotland.
The Scottish Government welcomed the company's power purchase agreement (PPA) with Fallago Rig, one of the UK's largest onshore wind farms.
Energy Minister Fergus Ewing said: "It is great news for Scotland and the environment that a company the size of BT is taking a local and sustainable approach to sourcing its electricity in Scotland from renewable and low carbon sources.
"With EDF Energy and BT now sharing 100% of the energy produced by Fallago Rig, it also secures generation at the site for the long-term future and shows the importance of Scottish renewable energy to Scottish-based businesses and their customers."
The 144 Megawatt (MW) wind farm in an area of the Lammermuir Hills is majority owned by funds managed by Hermes GPE Infrastructure, BT said. EDF Energy Renewables continue to own a minority stake in the wind farm and will still manage the site.
The wind farm development was approved by Scottish ministers in 2010 despite a campaign of opposition from a group called Say No To Fallago.