Sonya Warren was declared the new councillor for the multi-member ward of Buckie, with 1,485 votes.
Independent Norman Caldwell came second with 696 votes, with Conservative Tim Eagle third on 315.
Independent councillor Joe Mackay died in January, leading to the by-election. The turnout was 32.3%. The 26-member Moray Council is led by an Independent and Conservative coalition.
The result means that the number of SNP councillors is now 11, equal to the number in the administration group.
The SNP also won council by-elections in Fife and West Lothian on Thursday.
The SNP has won a Moray by-election following the death of a councillor.