Large quantities of mouse droppings were found across the Avonmouth warehouse, including the in-store bakery, delicatessen cold food store and food aisles.
One horrified customer discovered a dead mouse sandwiched between part-baked bread rolls, while another found her chocolate brioche had been nibbled.
Authorities were contacted when a shopper claimed she reported rodent-damaged Christmas baskets to a manager - then saw them sold in a "reduced" aisle the next day.
Bristol Crown Court heard the Avonmouth warehouse - one of Costco's 24 UK stores - had suffered mice problems since opening in 2005.
Costco hired numerous pest control companies, which used measures including sniffer dogs and heat sensors to resolve the problem but it persisted, the court was told.
The company admitted four offences under the Food Hygiene Regulations 2006 and a charge of placing unsafe food on the market contrary to General Food Regulations 2004, relating to a two-month period last year.
"The defendant is a well-known large store operating within the UK and worldwide," the judge said.
"They operate 24 stores within the UK.
"The store in Avonmouth opened in early June 2005 and it was in early January 2012 that a member of the public reported to officers at Bristol City Council that she had noted the presence of mouse-damaged food at the defendant's premises.
"The officers arranged for an inspection of the premises and made that inspection on January 27.
"They found when they went to the store what can only be described as a very substantial mouse infestation.
"It is unnecessary for me to give details of that infestation but it was one which was sufficient to pose an imminent risk to public safety.
"The manager of the store had the good sense to immediately make those areas of the store affected inaccessible, straight away, to members of the public."
Judge Roach told the court he had visited the Costco warehouse in Avonmouth and members of his family used to be cardholders.
Costco in Avonmouth received complaints from customers about mice from September 2009 to January and February 2012, when proceedings were launched.
Linda Tyrrell found a dead mouse between packets of part-baked rolls when shopping before Christmas 2011 and reported it to staff, who said it must have come with the packaging.
Another customer, Clair Stuckey, found Christmas baskets containing cakes and biscuits with rodent damage on January 22 2012.
She returned to the store the next day and called Bristol City Council after allegedly finding the baskets had been placed in a "reduced section" in a different area.
Inspectors from the council visited the store on January 27 and found "clear evidence of a substantial mouse infestation", prosecutor Iain Macdonald told the court.
Mr Macdonald said: "These findings were such that the officers considered that the affected parts of the store constituted an imminent risk to public health.
"The presence of such widespread evidence indicated that food, including ready to eat food, was not being adequately protected from the risk of contamination due to physical contact with mice.
"Some food packaging which was contaminated by contact with droppings and urine was likely to come into contact with ready to eat foods."
Store manager Russell Bloomfield closed six aisles of the store - confectionery, crisps, cereal, sugar, rice and part-baked lines - and destroyed £1,500-worth of stock.
But when officers revisited the store on four further occasions, they found further evidence of infestation, Mr Macdonald said.
Droppings were discovered across the warehouse and nibbled boxes with gnawed food inside were also noted.
David Travers QC, representing Costco, said the company accepted the problem "was not addressed quickly enough".
He said: "It is a comfort that the court can take from this case there is an awareness and willingness to learn from events that happened here.
"Costco is a company of good character. It has no previous convictions for health and safety and food safety. This was a local problem."
Mr Travers said an inspection of the Avonmouth warehouse's cafe carried out last year and this year returned a five-star rating for food hygiene - the highest available.
Speaking after the case, a spokesman for Costco insisted the company takes food safety and pest control "very seriously".
"It is regretted that on this occasion the company has fallen short of its usually high standards," he said.
"There was no harm to our members or others, but the circumstances giving rise to the offences were unacceptable."
The spokesman said action had been taken to "further strengthen" the pest control arrangements for the Avonmouth warehouse.