Harassed workers will be able to take legal action against their employer if they fail to protect them and knowingly allow sexual harassment to take place at work.
The ruling follows a case brought by the Equal Opportunities Commission which argued ministers had failed to apply the European Equal Treatment Directive, which implements sex discrimination law.
It said the current definition of harassment was too narrow and failed to ensure that employees were not subjected to any "unwanted conduct related to their sex which violates their dignity or creates an intimidating, hostile, degrading, humiliating or offensive environment".
Mr Justice Burton said a woman should be protected against harassment if her boss knew of such conduct, but failed to take any steps to prevent it.
Business leaders argued that although there should be zero tolerance of bullying and harassment in the workplace, if it came from members of the public it could be difficult for employers to manage.
Law firm Mace & Jones said that although employers could not eliminate the risk entirely, they should take steps to reduce it as far as possible and ensure that workers know how to react.