A federal judge has thrown out a $1.3 billion jury verdict against German business software maker SAP AG, slamming the penalty as “grossly excessive” and dealing an unexpected setback to SAP’s Silicon Valley rival Oracle.

The ruling Thursday is a surprising twist in a landmark intellectual property case.