RIO VISTA, Calif. — As the Merva W puttered down the Sacramento River, it looked like any other dowdy fishing vessel headed toward the Golden Gate Bridge. But no other boat had as surprising a cargo or as unusual a mission: The Merva W was giving 100,000 young salmon a lift to the Pacific in the hope of keeping them alive.

The record drought in California is not only forcing cities to ration water and farmers to sell off cattle. It is also threatening millions of salmon because the newly shallow rivers lack a strong enough flow to guide the fish to sea. And in the warming rivers, more predators are lurking.

In an act that is equal parts despair and hope, the government is transporting the salmon by truck and barge, trying to imitate nature so that in three years some fully grown fish will find their way back upstream. For some salmon, “this is a way of sustaining the fishery,” said Peter B. Moyle, a senior biologist at the University of California, Davis. “For an endangered species, it’s a desperation measure.”

This spring, some 30 million salmon will go to sea. In three years, the hope is that tens of thousands will return.