Five to six hours might be just enough time. You can get to Astoria on Highway 30 from Portland in about 2 hours. From there you can travel south on 101 to Seaside, Cannon Beach, etc., and return to Portland on Highway 26 – which is again about a 2 hour trip. On 101 you’ll have plenty of opportunities to pull over at scenic viewpoints or to stop in towns or at parks. If you have slightly more time I’d recommend staying on 101 south all the way to Tillamook, home of the famous cheese factory, and then return to Portland via Highway 6.