Deputies say David Lastra attacked Joseph Dominguez on the recreation yard at the Merced County Jail facility with a seven-inch shank.
Sheriff Vern Warnke said Lastra stabbed him because he believed Dominguez assaulted one of his family members a year ago.
Deputies say Dominguez suffered a collapsed lung and is recovering at a Modesto hospital.
Both Lastra and Dominguez are incarcerated for separate murder charges.