The draw made on Friday means there will be back-to-back Clasicos, with the second leg due to take place in the last week of February, before Madrid host Barca in La Liga on March 2.
The first leg will be played at the Camp Nou next week before a return at the Santiago Bernabeu. Real Betis will play Valencia in the other semi-final.
Real Madrid's club director Emilio Butragueno said after the draw: "Madrid against Barcelona is one of the best matches that can be seen all over the world today. It will be a great knock-out match."
Barca are chasing a record fifth Copa del Rey success in a row while Madrid are into the last four for the first time since they won the competition in 2014.
Two Clasico games in a week will crank up the pressure on both teams at the end of the month but Real also have a testing schedule around the first leg, sandwiched between a city derby against Atletico in La Liga and their Champions League last-16 first leg away to Ajax.
Real reached the Copa del Rey semis after completing a 7-3 aggregate victory over Girona on Thursday while Barcelona pulled off a brilliant comeback to beat Sevilla, overturning a 2-0 first-leg deficit by winning 6-1 at the Camp Nou.
Valencia scored two late goals to overcome Getafe on Tuesday and Real Betis needed extra time to knock out Espanyol.