Graham scored the third of Scotland's five first-half tries on Saturday to bring his total to 29 in 41 international appearances and equal Duhan van der Merwe's record as they warmed up for their Test against Australia next weekend with a confident strut.
There were also tries for Arron Reed (2), Will Hurd, captain Stafford McDowell, Josh Bayliss, Jamie Bhatti, Jamie Dobie and a penalty try for a second-string Scottish side, who took four minutes to open the scoring in a sometimes chaotic spectacle.
Flyhalf Adam Hastings put over five conversions and Tom Jordan one.
Portugal, whose play at times seemed without structure and blighted by loose passes, tightened up after a frenetic opening period and scored three tries in an impressive show of determination despite being outgunned by their powerful hosts.
The first came from a lineout maul at the end of the first half, with hooker Luka Begic powering over, and then a dart over the line from their 36-year-old scrumhalf Samuel Marques in the 55th minute after Portugal's replacement front row pushed Scotland's scrum back onto its heels.
Portugal's wing Raffaele Storti jinked his way through for another in the 67th minute.
The win makes it two out of three for Scotland in their four-match November international schedule at Murrayfield, after beating Fiji but losing to South Africa last weekend.