Federal funds will help upgrade the New England Central Railroad main line through western Massachusetts, making the north-south line ready to handle the standard weight of modern freight cars, according to Sen. Edward Markey’s office.

The senator’s office reported Monday that $10.8 million has been granted through a Better Utilizing Investments to Leverage Development (BUILD) grant to update the corridor’s infrastructure. The project is designed to replace 31 miles of rail and 20,000 crossties and will strengthen 20 bridges.

The federal funds will be combined with $9.6 million in state funding through the Mass. Department of Transportation and $9.6 million from the New England Central Railroad.

“With this BUILD grant, we can finally close a crucial gap preventing Massachusetts producers and consumers from enjoying a more efficient, cost-effect freight network,” Markey said in a statement. “This robust federal investment will create jobs and spur growth and economic activity in the region. From Worcester, to Springfield and beyond, this BUILD grant will make the region more competitive in an increasingly globalized economy.”

In July, lawmakers wrote to U.S. Transportation Secretary Elaine Chao asking her to consider federal funding, citing previous investments in the line in Vermont, New Hampshire and Connecticut.

“This project would create a significant north-south heavy rail capacity corridor in Massachusetts, dramatically increasing the ability of industry in our Commonwealth, and indeed along the entire corridor, to compete and serve their customers,” Markey wrote in a letter also signed by Sen. Elizabeth Warren, Congressman Richard Neal of Springfield and Congressman Jim McGovern of Worcester.

The corridor runs through 55 miles of Massachusetts land, from Monson to Northfield.