There aren't many things that can get you in trouble in Portugal as a tourist, however a couple of things need to be mentioned.
In 2001, drugs were decriminalized in Portugal, resulting in significant drops in drug-related crime, drug overdoses, and HIV infection. However, it's still illegal to have drugs in your possession for personal use and drug usage in general. These offensives are treated in a more administrative manner such as a warning, fine or directed into a drug use reduction program.
Drugs are quite common in Portugal with tourists often being approached with the offer to sell. Many travelers report having been solicited to purchase harmless items such as sunglasses, only to quickly find out that the merchandise being sold is actually drugs. This is something to look out for because the police are very present and watchful for these types of drug deals.
Many times the police are even responsible for setting up these transactions as sting operations, which can result in an unsuspecting tourist being arrested and jailed. The police in Portugal take drugs very seriously and so should you. If approached, firmly refuse and keep walking.
Another thing to keep in mind: don’t hop on public transportation without paying. Unfortunately, some people try to get away with using buses, trains, and even the metro without paying (by blending in with the crowd or sliding behind a friend). Not only is this unethical but it can result in a hefty fine if caught. And the police do make random checks, even stopping buses at night to ensure that everyone on board has a valid ticket.