Scotland will look to end an 11-year winless run against South Africa when they host the world champions in November next year as part of their autumn internationals season.
Scotland will also play host to Australia and a third side, which will be announced in due course, with the fixtures set to take place on the weekends of November 6, 13 and 20 respectively.
Scotland have lost their last six meetings with South Africa since their 21-17 victory a decade ago.
"The Autumn Internationals in 2021 will be another opportunity for our players to represent their country, hopefully with our fans in attendance, and provides the team with a different challenge and exciting challenge as a result," Scotland head coach Gregor Townsend said in a statement.
WHAT WERE YOU SAYING: All Blacks captain Cane and Foster silence the critics
Townsend's side will also be looking for a hat-trick of victories against Australia, having won their last two encounters in 2017.
Rugby Australia is expected to announce the Wallabies' Test calendar for 2021 in the coming weeks.
The Wallabies' return to Murrayfield will also be a homecoming of sorts for defence coach Matt Taylor, who spent eight years in Scotland under Townsend with first Glasgow and then the national team.
Wallabies coach Dave Rennie also left Scotland earlier this year after the best part of three seasons at Glasgow.
- With Christy Doran