Sociedad were dominant against an Elche side playing their first top-flight game for five years. But they only broke the deadlock in the 56th minute when Spain international Merino produced a sumptuous threaded pass to Portu, who fired into the far corner from a tight angle.
They extended their lead in the 77th when Adnan Januzaj scored from the spot after winning a penalty, and Roberto Lopez adorned a stylish win by blasting into the top corner in added time after another defence-splitting pass from Merino.
Daniel Wass gave Javi Gracia's men the lead against the run of play shortly before halftime when his free kick from way out, meant as a cross, went straight into the far corner of the net, evading the touch of defenders and attackers alike.
Huesca, who had been playing the more intelligent and imaginative football, kept their composure and continued to test goalkeeper Jaume Domenech and finally beat him with a looping header from Greek defender Dimitris Siovas in the 63rd.
Valencia, who were beaten 2-1 at Celta Vigo last week and parted with several key players over the summer, have four points from their opening three games while Huesca have two.
Meanwhile, Alaves picked up their first point of the campaign after a goalless draw at home to Getafe.