MEXICO CITY — The Mexican government is making a final effort to save the vaquita, a tiny porpoise that has been driven to the edge of extinction as a result of illegal fishing for another endangered species that is served as a delicacy in China.

Scientists say that fewer than 100 of the vaquita, a marine mammal, remain in its habitat, the northern Gulf of California. Several thousand fishermen working there depend on the yearly shrimp catch for a modest living.

The fishermen’s gillnets, stretching for miles across the sea, have long been a lethal threat to the vaquita, which become entangled in them and die. But over the past few years a new threat has emerged: illegal fishing for a large fish called the totoaba whose swim bladder is dried and cooked in soup in China, where some consumers believe it has medicinal properties. The vaquitas are also caught and killed in the nets set for totoaba.

The government’s new policy, which Rafael Pacchiano Alamán, an under secretary in the Environment Ministry, announced on Friday, will ban gillnets for two years across 5,000 square miles of the upper gulf and compensate the fishermen for their lost catch.