The deal, however, contains only a fraction of the money Trump wants for his promised border wall and does not mention a concrete barrier. It still needs to be approved by Congress and signed by the President, the New York Times reported.
Speaking later, Trump promised to finish building the border wall regardless of what the Democrats and Republican legislators agreed to in the Congress. "We're building the wall anyway," he said at a rally in El Paso, Texas.
In a crowded stadium with banners saying "Finish the Wall", Trump told supporters: "Walls work... Walls save lives."
The tentative agreement allocates funding for the construction of 55 miles of new fencing, built through existing designs such as metal slats, instead of the 215-mile concrete wall demanded by Trump in December.
The President said his government had already built a large part of the wall and now wanted to finish it as soon as possible.
As Trump spoke, Beto O'Rourke, a former Democratic Congressman and potential presidential candidate in 2020, held a counter-rally, accusing Trump of stoking false fear about immigrants with "lies".
O'Rourke told a crowd of supporters in his hometown El Paso that it was time to "show the country that there is nothing to be afraid of when it comes to the US-Mexico border".
"Walls do not save lives, walls end lives," he said.
The negotiators announced they had reached the agreement after three private meetings on Monday. It was expected to be finalised as early as Tuesday, well before the Friday deadline when funding would have lapsed again for a number of federal agencies.
The shutdown cost the economy USD11 billion and reduced growth forecasts by almost half a percentage point, the congressional budget office estimated.
Democrats have opposed funding for a border wall, saying that pressure from undocumented immigrants was a made-up emergency and that money for border security would be better dedicated to additional technology, personnel and other enforcement measures.
The negotiators also agreed to reduce the number of migrants and undocumented immigrants who can be held in detention. Democrats' demand for a limit on how much detention space could be used for unauthorised immigrants arrested within the US had threatened to derail the negotiations over the weekend, but lawmakers agreed to waive the demand, the report said.
There was also an agreement to reduce the number of beds in detention centres to 40,250 from the current 49,057.
Beyond the border barriers, the agreement, which primarily funds the Department of Homeland Security, would provide USD1.7 billion more for border security, including technology at ports of entry, more officers and humanitarian aid.
"The fact that it looked like there was going to be another shutdown imminently brought renewed efforts on Monday," The Washington Post quoted Senate Appropriations Committee Chairman Richard C. Shelby as saying after announcing the deal.
Asked if the White House would support the agreement, Shelby, a Republican from Alabama, told the media: "We think so. We hope so."
House Appropriations Committee Chairman Nita M. Lowey said she hoped the negotiators would have a finished product by Wednesday.
Asked by the media if the government would shut down again, Trump responded: "That's up to the Democrats."
Meanwhile, he has also readied a plan to declare a national emergency on the southern border, which he believes will allow him to redirect taxpayer money from other projects to build parts of a wall - without approval from Congress.