Unable to work a trade with Orlando for Dwight Howard, the Nets used the first day contracts could be signed to get a deal done with their current centre.
Lopez had been linked to the Magic in trade talks for months, but now knows he will at least begin the season in Brooklyn. He is ineligible to be traded until Jan. 15.
A person with knowledge of the negotiations, who spoke on condition of anonymity because the terms have not been announced, said the deal is worth $60 million.
"Brook Lopez is one of the top young centres in the NBA," Nets general manager Billy King said. "We have witnessed his growth as a player over the past four years, and are very pleased that he will remain in a Nets uniform as we begin our new era in Brooklyn."
Lopez was limited to five games last season because of injuries, averaging 19.2 points. He had appeared in 82 games in each of his first two NBA seasons and has a 17.4-point career average.
The Nets have already re-signed Deron Williams and Gerald Wallace in a busy off-season, plus acquired All-Star Joe Johnson from the Atlanta Hawks. They also signed Bosnian forward Mirza Teletovic and acquired veteran forward Reggie Evans from the Los Angeles Clippers.
The Clippers will have the right to swap second-round draft picks with Brooklyn in 2016.
Teletovic averaged 16.3 points and 6.9 rebounds with Caja Laboral Vitoria of the Spanish ACB League last season.