Sanchez' visit comes less than a year after he drew a line under a year-long diplomatic crisis by reversing decades of neutrality on the Western Sahara conflict to back Morocco's position, sparking anger among his far-left coalition partners.
Sanchez has defended his move as essential for Spanish interests.
Addressing an economic forum on Wednesday evening, he said that "the better relations are between Morocco and Spain, the better it is for Spain, the better it is for Morocco, the better it is for Europe and for the citizens of both countries".
The crisis had begun in 2021 when Madrid allowed Brahim Ghali, leader of the Polisario Front which seeks independence in the Western Sahara, to be treated for Covid-19 in a Spanish hospital.
Weeks later, more than 10,000 migrants surged into Spain's tiny Ceuta enclave as Moroccan border forces looked the other way, an incident seen as a Moroccan move to punish Madrid.
In March last year, Madrid announced a "new stage" in relations and said it backed the North African kingdom's plan for the Western Sahara of limited autonomy under Moroccan sovereignty.
The following month, Sanchez paid a high-profile visit to Morocco and was hosted by King Mohammed VI.
But Sanchez has faced criticism from both left and right for the concession to Morocco, including from his administration's number three, Labor Minister Yolanda Diaz of the hard-left Podemos party.
She has declined to join this week's trip, in line with her hard-left Podemos party's rejection of Sanchez's "unilateral" reversal on Western Sahara.
Spain's right-wing opposition has also slammed Sanchez over the policy, with Gonzalez Pons, a member of the European parliament from the Popular Party, saying there was "no greater humiliation than bowing to the will of Morocco".
The opposition has also criticized Sanchez for holding a high-level visit without being hosted by the Moroccan king.
However, King Mohammed did this week invite the Spanish premier for a higher profile state visit in future to "reinforce the positive dynamic" in their ties, according to a palace statement.
High on the agenda will be cooperation over clandestine migration and terrorism.
After resuming cooperation with the kingdom, Spain's interior ministry reported that arrivals of irregular migrants on its territory from Morocco were down by a quarter last year compared with 2021.
Both countries faced criticism from human rights groups after at least 23 migrants died during a mass attempt to enter the Melilla enclave in June 2022.
Spain's Interior Minister Fernando Grande-Marlaska is set to ask his Moroccan counterpart Abdelouafi Laftit to return deportations of irregular migrants to pre-Covid levels, according to a ministry official.