The wife of jailed Malaysian opposition leader Anwar Ibrahim has won his seat in a by-election, officials said on Friday, one of two votes held this week that were seen as a test of Prime Minister Najib Razak's leadership.