1 of 2 | Thousands of Spaniards and Gibraltarians celebrate shortly after midnight as the border fence between Gibraltar and Spain is dismantled in La Linea de la Concepcion, Spain, Wednesday. The dismantling follows five years of talks between the United Kingdom and the European Union and the signing of a treaty to open the border Tuesday. Photo by A. Carrasco Ragel/EPA

July 15 (UPI) -- Spain and Gibraltar celebrated just after midnight Wednesday as border checkpoints and walls came down between the two nations after a treaty was signed in Brussels.

At midnight, the police stepped down from their border posts to open the territory, and thousands rushed across the border in both directions, celebrating the new crossing and Spain's World Cup win against France in the semifinals, The Telegraph reported.

Spanish Prime Minister Pedro Sánchez visited the Spanish border town of La Línea de la Concepción on Wednesday to see the removal of the last section of a border fence. He said an "open wound" was finally closed, The Guardian reported.

"The Gibraltar fence -- the last wall in continental Europe -- has fallen so that we can take a step towards a new era of coexistence and shared prosperity," Sánchez said. "This is a deal that has the wellbeing of the 300,000 Andalucíans in the Campo de Gibraltar at its heart and which opens a new phase in the relationship between Spain and the U.K."