Drug developer Pfizer Inc. said Wednesday a Spanish court upheld its patent covering the active ingredient in the blockbuster cholesterol drug Lipitor, though it did find a second patent for the drug invalid.

The company is facing a generic challenge by drug maker Ranbaxy. Pfizer sells Lipitor in Spain under the names Zarator and Cardyl.