Lord Śiva cannot be victimized by māyā. Therefore it is to be understood that Lord Śiva was being thus harassed by Lord Viṣṇu’s internal potency. Lord Viṣṇu can perform many wonderful activities through His various potencies.
parāsya śaktir vividhaiva śrūyate
svābhāvikī jñāna-bala-kriyā ca
(Śvetāśvatara Upaniṣad 6.8)
The Supreme Lord has various potencies, by which He can act very efficiently. To do anything expertly, He doesn’t even need to contemplate. Since Lord Śiva was being harassed by the woman, it is to be understood that this was being done not by a woman but by Lord Viṣṇu Himself.