Background: After the recent successes of genome-wide association studies (GWAS), one key challenge is to identify genetic variants that might have a significant joint effect on complex diseases but have failed to be identified individually due to weak to moderate marginal effect. One popular and effective approach is gene set based analysis, which investigates the joint effect of multiple functionally related genes (eg, pathways). However, a typical gene set analysis method is biased towards long genes, a problem that is especially severe in psychiatric diseases. Methods: A novel approach was proposed, namely generalised additive model (GAM) for GWAS (gamGWAS), for gene set enrichment analysis of GWAS data, specifically adjusting the gene length bias or the number of single-nucleotide polymorphisms per gene. GAM is applied to estimate the probability of a gene to be selected as significant given its gene length, followed by weighted resampling and computation of empirical p values for the rank of pathways. We demonstrated gamGWAS in two schizophrenia GWAS datasets from the International Schizophrenia Consortium and the Genetic Association Information Network. Results: The gamGWAS results not only confirmed previous findings, but also highlighted several immune related pathways. Comparison with other methods indicated that gamGWAS could effectively reduce the correlation between pathway p values and its median gene length. Conclusion gamGWAS can effectively relieve the long gene bias and generate reliable results for GWAS data analysis. It does not require genotype data or permutation of sample labels in the original GWAS data; thus, it is computationally efficient.