BOSTON – The nation’s inaugural offshore wind farm, planned off Cape Cod, has reached its first deal with a utility to purchase its power.

Under the agreement announced by both companies Friday, the utility National Grid would pay 20.7 cents per kilowatt hour starting in 2013 for half the power produced by the 130-turbine Cape Wind project planned for Nantucket Sound.

The price would go up by 3.5 percent annually to keep pace with inflation.

The deal is considered crucial to attract financing for a project estimated to cost at least $2 billion.

The deal must still be approved by state regulators.

Adjusted to today’s dollars, Cape Wind officials say the cost in the first year of the deal is 18.7 cents per kilowatt hour compared to the current cost of electricity of about 9 cents per kilowatt hour. The utility, which has 3.3 million customers in Massachusetts, New Hampshire, New York and Rhode Island, said the deal will add about $1.59 to the average customer’s monthly electricity bill in 2013.

National Grid U.S. president Tom King said the country must invest in renewable energy, even when it’s more expensive.

“This is about taking action to ensure that we have a clean energy economy in the future,” he said.

Cape Wind president Jim Gordon said, “The question is whether folks are prepared to pay 5 cents a day for a better energy future.”

Audra Parker of the Alliance to Protect Nantucket Sound, which opposes Cape Wind, noted that the utility’s projected rate hike amounts to about $23 million in the first year alone when it’s spread over its 1.2 million Massachusetts customers.

“Any way you slice it, it’s expensive power,” Parker said. “I think once the numbers are analyzed, I do think public and political support (for Cape Wind) will erode.”

Cape Wind, a privately held developer, received final approval last week from Interior Secretary Ken Salazar, who stepped in to bring resolution to a project that was in its ninth year of federal review. He touted Cape Wind as the start of a new clean energy industry in the U.S., which lags behind Europe in offshore wind development.

But critics say Cape Wind threatens wildlife and would destroy historic vistas and cultural sites in Nantucket Sound, all to benefit a private developer. Several opponents have vowed to stop the project in the courts.

Gov. Deval Patrick’s administration strongly backed Cape Wind, but cautioned costs must be reasonable. On Friday, Massachusetts Energy and Environmental Secretary Ian Bowles said the proposed deal’s price “is better than I expected.” He said his analysis, which subtracts a renewable energy credit he said consumers would pay the utility anyway, puts Cape Wind’s power at 12.6 cents per kilowatt hour.

That price is comparable to the 13 cents per kilowatt hour paid for natural gas at its peak two years ago, before the recession, he said. Bowles said he believes the deal will ultimately save Massachusetts ratepayers money over the life of the deal, given the pre-recession trend of natural gas prices rising at a higher rate than inflation.

Last month, Rhode Island regulators rejected a deal between National Grid and Deepwater Wind to buy power from a planned an eight-turbine wind farm off Block Island, citing the high price.

King said that deal was primarily undone by Rhode Island’s fiscal condition and he was optimistic about a different result with Cape Wind, saying Massachusetts leaders had “an absolute desire to see renewables advance forward.”

Massachusetts requires utilities to seek long term deals up to 15 years with renewable power developers to provide at least 3 percent of their loads. King said National Grid meets the mandate by purchasing half of Cape Wind’s expected output — about 264 megawatts.