Canada's two major railways shipped record amounts of grain over the past crop year despite a gauntlet of obstacles.

Canadian National Railway Co. hauled more than 30 million tonnes of grain in 2019-20, a seven-per-cent increase from the previous year.

Canadian Pacific Railway Ltd. moved 10 per cent more grain at 29.5 million tonnes.

The railroads attribute the achievement to investments in their network that included high-efficiency hopper cars and twinning sections of the main line.

Other factors include a bounty of grain held over from last year following a late harvest as well as insatiable global demand for bread and pasta amid the COVID-19 pandemic, which has prompted rival wheat-producing countries to curb exports in order to build up domestic stores.

The record grain figures come after a tumultuous crop year that saw a CN strike in November, rolling rail blockades in February, landslides, trade disputes and the coronavirus, which dented shipment volumes from automotive to metal and triggered more than 5,000 layoffs between the two railroads.