40 minutes in SEA is a legal connection. You might have to move quickly, though; the inbound flight from PDX has a good chance of arriving at the C2 gates in SEA, and I usually see the Newark flight leaving from the N gates, requiring several minutes of walking and a train. They might be out of overhead bin space by the time you got there, as well. If you're luckier and you arrive and depart out of the same concourse, it'll be no trouble; however, there's no way to predict that in advance.
If you could switch to the next earlier PDX-SEA shuttle flight, it would eliminate any stress.