Susan Rowley applied for the post of principal teacher (pastoral) in 2004.
The job went to a male colleague who, it was claimed, did not share her experience and qualifications. Mrs Rowley, with backing from the Equal Opportunities Commission, took her case to an employment tribunal and was awarded pound;16,000, including pound;5,000 for injury to her feelings.
The tribunal found that the school's head and depute "watered down" the specification so that the successful candidate would be able to make the shortleet. After being told she had only narrowly missed out on the post, Mrs Rowley had been marked third, not on the post-interview forms, but on a separate sheet of paper at a later stage.
The tribunal also said the recruitment process was superficial and hastily based on "impressionistic" assessments of candidates and that the way the recruitment process was conducted allowed discrimination to set in.
Rob Kelly, the headteacher, failed to follow the council's own policies and procedures in recruitment and selection.
Mrs Rowley, who has now left teaching, said: "To have put in so much work gaining qualifications and experience required to be a good pastoral care teacher and then see it count for nothing was frustrating and disappointing. I hope that my case will make Scottish Borders Council take action on recruitment issues and make sure this does not happen to other women teachers."
David Hume, the council's chief executive, responded that two years ago the council's own policies were not applied consistently. "As an organisation, one of our key values is equality of opportunity, and sexual discrimination is simply not tolerated in this council," Mr Hume said.
Since the case, headteachers, quality improvement officers and other senior managers involved in appointments have been through extra training. Mr Hume said the authority had taken advice from a specialist in employment law, specifically in gender balance and interview procedures.
Rowena Arshad, EOC commissioner in Scotland, said it was important recruitment processes were "transparent and above board", otherwise schools would leave themselves open to "jobs for the boys allegations".