Writing on its Facebook page, West Yorkshire Fire and Rescue Service said the animal had reached an “inescapabull position”.
A specialist technical rescue team was called to the Norwood Green area, near Bradford, to help with the re-moo-val.
The service said: “Crews and the farmer managed to dig a hole around the trapped cow and once the hole was big enough they used a lifting sling to cow-ordinate the animal out of the hole.
“The cow was rescued unharmed.”
Social media users praised the firefighters for their work.
One said: “Good work everyone. Heroes without a cape. I can see why my son wants to be just like you one day.”
Another said: “Well done to you all, what kindness there was to save this cow.
“My heart goes out to you all. Thank god we have folks like you that care.”