The international friendly between the two European Championship finalists will be staged at the new City Arena stadium in Trnava on 4th June (kick-off time TBC).
The following day Northern Ireland will jet off to their base camp in France to complete their preparations for their first group game at the Euros - against Poland in Nice on 12th June.
Slovakia automatically booked their place at the Euros after finishing runners up to Spain in their qualifying group. They will take on England, Wales and Russia in Group B at EURO 2016.
They were also in the same qualifying group as Ukraine, who Northern Ireland will face in Lyon on 16th June in their second group match at EURO 2016. Slovakia won 1-0 in Ukraine and then drew 0-0 with them at home.
And Slovakia registered a famous win against Spain in qualifying. Their 2-1 home victory against the reigning European champions in Zilina in October 2014 ended Spain’s eight-year, 31-match unbeaten run in the competition.
Northern Ireland manager Michael O’Neill said: “I think this will be a good game for us. Slovakia play in a similar style to Poland and Ukraine.
“I wanted one game at home and one game away before going to France. This game is eight days before our opening game in France and I feel that is ideal.
“It will also allow us to have a training camp in central Europe before we head off to France.”
The star name in the Slovakian side is attacking midfielder Marek Hamsik, who has been a top performer for Napoli in Italy’s Serie A since 2007.
National team captain and Liverpool defender Martin Skrtel is also a key member of their squad alongside AC Milan midfielder Juraj Kucka and Slovan Bratislava striker Robert Vittek, who has scored 23 times for his country. Qatar-based Vladimir Weiss, whose previous clubs include Manchester City, Bolton, Rangers and Espanyol, is in their team, too.
Northern Ireland last played Slovakia during the 2010 World Cup qualifying campaign. Northern Ireland lost both games, 2-1 away and 2-0 at home.
Details of Northern Ireland’s final home friendly in the run-up to the Euros - which will be staged towards the end of May - are still to be confirmed.