The general counsel of Hewlett-Packard Co. announced her resignation Thursday, shortly before the company’s former chairwoman told Congress she was never advised that HP’s spying probe involved illegal tactics.

Ann Baskins had been with HP for 24 years, including the past six as the company’s top in-house lawyer. She had been scheduled to testify to a House committee as well, but she invoked her Fifth Amendment right against self-incrimination and did not answer lawmakers’ questions.