A High Court ruled that it was unlawful to end employment on the grounds of a person's HIV status. The decision is the first such ruling in Kenya and is hailed as a victory for HIV campaigners.
About 2.5m out of 32m Kenyans are currently living with HIV/Aids.
Jacqueline Adhiambo Ongur, a 45-year-old waitress, also sued her doctor for revealing her HIV status without her consent. But none of the defendants admitted liability.
Mrs Ongur's former employer, Home Park Caterers, said the company had not requested a medical test, and was not aware of her status when she was sacked.
But the former waitress told the court that her letter of termination said she had been sacked on medical grounds, and for being unable to perform her duties.
Mrs Ongur says she filed the case to focus attention on the rights of people living with HIV/Aids.
She says she has endured hardship since she was sacked and has not been able to get another job.
Her lawyer said the case had been very challenging as Kenya's constitution does not expressly prohibit discrimination on grounds of HIV.
HIV/Aids activists have lauded the ruling saying it is a victory in the fight for the rights of people living with HIV/Aids.
"It's a lesson and a message to employers that people living with HIV and Aids have got rights like any other person to work," activist Inviolata Mbwavi told the BBC's Focus on Africa programme.
"It will bring up many people who have suffered at the hands of their insensitive employers to come out and know that the law protects them."
People living with the virus still face immense stigmatisation, Ms Mbwavi said.
Mrs Ongur told the court that when she went to hospital complaining of chest pains and rashes, Dr Primus Ochieng tested her for HIV without her consent.
She told the court that Dr Ochieng and the Metropolitan Hospital then disclosed her status without her consent to her employer, in breach of doctor-patient confidentiality.
The court declared that testing employees or prospective employees for HIV without consent constituted an invasion of privacy and was unlawful.
Disclosing an employee's status to their employer without their consent was also unlawful, the court ruled.
The former waitress said her employer and colleagues knew about her HIV status before she did.
She said that she only found out it when she went back to the hospital and requested her medical report.
Mrs Ongur had worked for Home Park Caterers for eight years before she was dismissed.