SAN FRANCISCO — Hewlett-Packard Co. has largely prevailed on its motion to dismiss RICO claims brought by the Mexican state oil and gas company Petróleos Mexicanos, or Pemex. U.S. District Judge Beth Labson Freeman gave Pemex a chance to amend its complaint and suggested there will be no quick end to the case.

“Although defendants are largely successful on the issues presented in this motion, based upon the presentation made by Pemex in its brief and at the hearing, the court anticipates that sufficient facts can be pled to support the claims asserted,” Freeman wrote in a 26-page order Monday.